React-native-navigation: Unable to pop screen using custom stackId [ios]

Created on 3 Jul 2020  路  4Comments  路  Source: wix/react-native-navigation

Issue Description

Unable to pop screen from stack using custom stackId in ios

Steps to Reproduce / Code Snippets / Screenshots

My root structure is:
  Navigation.setRoot({
    root: {
      stack: {
        id: 'LoginStack',
        children: [
          {
            component: {
              name: 'com.Login',
            },
          },
        ],
      },
    },
  });

=> push to stack works
=> Navigation.pop('LoginStack'); doesn't pop the screen


Environment

  • React Native Navigation version: 6.8.0
  • React Native version: 0.62.2
  • Platform(s) (iOS, Android, or both?): iOS
  • Device info (Simulator/Device? OS version? Debug/Release?): all
iOS acceptebug

Most helpful comment

@jinshin1013

According to the doc pop api takes 'The componentId of a screen pushed into the stack, or the stack id.'.

https://wix.github.io/react-native-navigation/api/stack#pop

So it should work with both componentId and stackId .
It was working till RNN version:3.x.x.

It is working fine in android. Issue is on ios

All 4 comments

Hi @yasir2hats 馃檶 , Navigation.pop expects the componentId so you will want to do something like:

// If you have not specified the id.
const App = ({ componentId } => {
  function pop() {
    Navigation.pop(componentId)
  }
}

// If you have provided the id.
Navigation.setRoot({
  root: {
    stack: {
      children: [
        {
          component: {
            id: 'CUSTOM_ID',
            name: 'com.Login',
          },
        },
      ],
    },
  },
});

const App = ({ componentId } => {
  function pop() {
    Navigation.pop('CUSTOM_ID')
  }
}

@jinshin1013

According to the doc pop api takes 'The componentId of a screen pushed into the stack, or the stack id.'.

https://wix.github.io/react-native-navigation/api/stack#pop

So it should work with both componentId and stackId .
It was working till RNN version:3.x.x.

It is working fine in android. Issue is on ios

@yasir2hats I'm seeing the same behavior. Should we re-open this ticket or start a new one?

If the documentation is wrong, then it should be removed. If the documentation is correct, then there's a bug.

Hello, I encounter the same issue. We would certainly expect iOS to have the same behaviour as Android here. This ticket should be reopened imo (as an iOS bug).

Was this page helpful?
0 / 5 - 0 ratings