react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

Navigation.push is crashing the app

Open hamidhadi opened this issue 8 years ago • 6 comments

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

hamidhadi avatar Apr 19 '18 01:04 hamidhadi

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

wwwdata avatar Apr 23 '18 13:04 wwwdata

@hamidhadi Please PR a failing detox e2e test, otherwise we can't afford to look into this.

guyca avatar Apr 23 '18 14:04 guyca

as @wwwdata reports, documentation is incorrect and his example works

Slessi avatar May 02 '18 09:05 Slessi

Documentation fixed. thanks

yogevbd avatar May 02 '18 10:05 yogevbd

Same problem.

mariodev12 avatar Nov 20 '18 13:11 mariodev12

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

RajenderDandyal avatar Nov 27 '18 22:11 RajenderDandyal