Navigation.push is crashing the app
Issue Description
When I push from tab's root screen to another screen, the app is crashing.
Steps to Reproduce / Code Snippets / Screenshots
My navigation structure:
const MainNavigation = () => Navigation.setRoot({
bottomTabs: {
children: [
{
stack: {
children: [{
component: {
name: RouterConstants.FirstScreen
}
}],
options: {
bottomTab: {
icon: ...
}
}
}
}
.....
And in FirstScreen:
Navigation.push(this.props.componentId, {
stack: {
children: [{
component: {
name: RouterConstants.SecondScreen,
passProps: {
restaurantId: id,
restaurantSlug: slug
}
}
}]
}
})
Xcode error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing a navigation controller is not supported'
Environment
- React Native Navigation version: 2.0.2241
- React Native version: 0.54.0
- Platform(s) (iOS, Android, or both?): iOS
- Device info (Simulator/Device? OS version? Debug/Release?): Simulator/ 11.2/ Debug
I think the documentation is wrong. If you just leave out the stack and children sub-keys and directly start it with:
Navigation.push(this.props.componentId, {
component: {
name: RouterConstants.SecondScreen,
passProps: {
restaurantId: id,
restaurantSlug: slug
}
}
})
it works fine for me in v2
@hamidhadi Please PR a failing detox e2e test, otherwise we can't afford to look into this.
as @wwwdata reports, documentation is incorrect and his example works
Documentation fixed. thanks
Same problem.
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