[V2] Problems with push+dismissModal and showModal+pop
Issue Description
If you do a pop for a modal screen or dismissModal for a pushed-screen, then problems start.
Steps to Reproduce / Code Snippets / Screenshots
pushnew screen. Then calldismissModal. Result:
| My screens | Crash | Crash (Drawer opened) |
|---|---|---|
showModalnew screen. Then callpop. Then calldismissModal. Result: nothing happens!
Environment
- Checked with 3 versions of RNNv2:
2.0.2459,2.0.2500,2.0.2519 - React Native version:
0.55.4 - Platform(s) (iOS, Android, or both?):
iOSonly - Device info (Simulator/Device? OS version? Debug/Release?):
Debug
My stack
Navigation.setRoot({
root: {
sideMenu: {
left: {
component: {
id: SCREENS_NAMES.leftDrawer,
name: SCREENS_NAMES.leftDrawer
}
},
center: {
bottomTabs: {
children: navigationSettings.bottomTabs.map(t => ({
stack: {
children: [
{
component: {
name: t.name,
passProps: {
...(t.passProps || {})
},
options: {
bottomTab: {
icon: getIconSource(t.icon),
},
topBar: {
visible: true,
title: {
text: t.title,
},
},
}
}
}
],
}
})),
}
}
}
}
}).then(() => console.warn("App launched with RNN v2 =))"));
Where navigationSettings.bottomTabs is:
[
{
name: SCREENS_NAMES.testHome,
title: 'Главная',
icon: INITIALIZED_ICONS_NAMES.home,
// ...
},
{
name: SCREENS_NAMES.test,
title: 'Test',
icon: INITIALIZED_ICONS_NAMES.test,
// ...
},
]
Hey @iksent
Thanks for the detailed report. I'm wondering if awaiting the initial command resolves these issues.
We should probably add e2e to these use cases.
@guyca, Hello.
So what should I check?
Wait for the push command to complete
await Navigation.push(...);
Navigation.dismissModal();
@iksent What exactly do you mean by "pop for a modal screen or dismissModal for a pushed-screen"? Modals can't be popped, they can be dismissed and pushed screens are popped.
@guyca, "Modals can't be popped, they can be dismissed and pushed screens are popped." - Yes, you are right, but if you do such actions, navigation will behave inadequately. If you call showModal, after call pop or if you call push and after call dismissModal. I know, that such actions is not normal, but you should check, so that will not crash navigation.
@yogevbd Lets talk about this issue, we should add e2e for these use cases as well.
setting ...rightButtons: [{color: "#D84315", fontSize: 18}], inside setDefaultOptions-->topBar was crashing my app ..while calling .push or showModal ... everything back to normal after removing this property and adding color from static option