Unable to pop screen from stack using custom stackId in ios
Navigation.setRoot({
root: {
stack: {
id: 'LoginStack',
children: [
{
component: {
name: 'com.Login',
},
},
],
},
},
});
=> push to stack works
=> Navigation.pop('LoginStack'); doesn't pop the screen
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).
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