React-native-router-flux: TypeError: undefined is not an object (evaluating 'route.routeName')

Created on 19 Dec 2017  ·  26Comments  ·  Source: aksonov/react-native-router-flux

Version

Tell us which versions you are using:

  • react-native-router-flux ^4.0.0-beta.24 (v3 is not supported)
  • react-native v0.50.1

Actual behavior

screen shot 2017-12-19 at 10 01 30

The problem is caused by react-navigation v1.0.0-beta.22: TypeError: undefined is not an object (evaluating 'route.routeName')

Can we release a version with the react-navigation version freezed to v1.0.0-beta.21? beta.22 seems to be too buggy, it's having other issues:

Most helpful comment

In my case it was caused by drawer. I found this issue in react-navigation that solved it.
So now my drawer component looks like this

<Drawer 
    key='drawer' 
    contentComponent={NavigationDrawer} 
    drawerWidth = {0.8*Metrics.screenWidth}
    //following props added to fix the issue
    drawerOpenRoute = 'DrawerOpen'
    drawerCloseRoute = 'DrawerClose'
    drawerToggleRoute = 'DrawerToggle'
>

maybe it will help someone

All 26 comments

I got the same issue with this code

export default class Screens extends React.Component {
  render() {
    return <Router>
      <Scene key="root">
        {/* <Scene key="register" component={Register} title="Register"/> */}
        <Scene key="drawer" drawer contentComponent={SideMenu} >
          <Scene key="main">
            <Scene key="home" component={Home} hideNavBar={true}/>
          </Scene>
        </Scene>
      </Scene>
    </Router>
  }
}

I getting the same issue with the following code

              <Router
                titleStyle={{ color: '#FFFFFF' }}
                navigationBarStyle={{
                    backgroundColor: '#2FA5FF',
                }}
                sceneStyle={{ backgroundColor: '#F5FCFF' }}
                backAndroidHandler={this.onBackPress}>
                <Scene key="root">
                    <Drawer
                        title="Menu Options"
                        key="drawer"
                        contentComponent={DrawerContent}
                        drawerWidth={250}
                        drawerImage={MenuButton}
                    >
                        <Scene
                            headerTintColor="#FFFFFF"
                            key="Home"
                            initial
                            title="Home"
                            component={Home} />
                        <Scene
                            headerTintColor="#FFFFFF"
                            key="pairedDevices"
                            title="Paired Devices"
                            component={PairedDevices} />
                        <Scene
                            headerTintColor="#FFFFFF"
                            key="chart"
                            title="Chart"
                            component={TimeSeriesLineChartScreen} />
                        <Scene
                            headerTintColor="#FFFFFF"
                            key="blemanager"
                            title="BLE Manager"
                            component={BLEManager} />
                    </Drawer>
                </Scene>
            </Router>

But it was working 2 hours before, I installed react-navigation and then I uninstalled immediately, After that I was stuck with this issue.

I have the same issue here , downgrade to react-navigation v1.0.0-beta.21 solved the problem for now

@Shariaty How did you downgrade react-navigation particularly? Because it is installed as dependency for react-native-router-flux right ?

@Anandks1993 replace the node_modules with one of my older projects that has the react-navigation beta.21 and router flux "^4.0.0-beta.24", it is a temporary fix.

Okay, for me too now it is working after downgrading react-navigation. Thank you

+1

Check latest master, I locked rn version

19 дек. 2017 г., в 17:37, Ariel Falduto notifications@github.com написал(а):

Any update?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@Balpi thankyou for referencing, i just did it and worked

Running npm install git+https://github.com/aksonov/react-native-router-flux.git#37c6553 should work temporarily for you. It will install react [email protected] or do it through the package.json as well.

I have the same issue with this code:-
react-native-router-flux: 4.0.0-beta.22
react-native: 0.49.3

<Router
    backAndroidHandler={() => Actions.pop()}
    sceneStyle={styles.sceneStyle}
  >
    <Scene key="root">
      <Scene
        key="scene1"
        component={Scene1}
        title="Scene 1"
        navigationBarStyle={styles.navigationBarStyle}
        navBarButtonColor={styles.navBarButtonColor}
        titleStyle={styles.titleStyle}
        initial
      />
      <Drawer
        hideNavBar
        key="dashboard"
        drawerImage={Images.menuIcon}
        contentComponent={Navigation}
        drawerWidth={styles.drawerWidth}
      >
        <Scene
          key="dashboard"
          component={Dashboard}
          title={strings.dashboard}
          navigationBarStyle={styles.navigationBarStyle}
          navBarButtonColor={styles.navBarButtonColor}
          titleStyle={styles.titleStyle}
          renderRightButton={renderNotificationButton}
        />
      </Drawer>
    </Scene>
  </Router>

@shubham81407 Did you check what version of react-navigation is installed ? Now it should work as the version is locked to [email protected].

@Anandks1993 I have [email protected] version in package-lock.json

@shubham81407 Downgrade to [email protected], It will solve the issue.

@Anandks1993 Can you tell me why this issue is coming in [email protected]?
in previous days it's working fine in this version why?

@shubham81407 I don't know, May be some kind of bug :neutral_face:

@Anandks1993 thanks for the solution.

Same issue, and the same library is flagged failed on the npm website.

@shubham81407 [email protected] was released yesterday.

The error still exist when installing a new fresh router-flux or run npm install !!?
how should i install my other packages !!
my other package after installation dose not recognize react-native link command , and it says I should run npm install , after that link works but router flux and my drawer crash.

@Shariaty did you try to use the following dependency?

"react-native-router-flux": "git+https://github.com/aksonov/react-native-router-flux.git"

In my case it was caused by drawer. I found this issue in react-navigation that solved it.
So now my drawer component looks like this

<Drawer 
    key='drawer' 
    contentComponent={NavigationDrawer} 
    drawerWidth = {0.8*Metrics.screenWidth}
    //following props added to fix the issue
    drawerOpenRoute = 'DrawerOpen'
    drawerCloseRoute = 'DrawerClose'
    drawerToggleRoute = 'DrawerToggle'
>

maybe it will help someone

It was breaking change for latest RNav beta.22. Should be fixed with latest RNRF beta.26

You must use latest version of RNRF

On 15 Jun 2018, at 21:00, Michael Stelly notifications@github.com wrote:

I'm not sure what changed between January and now, but this issue arose again. Running the latest repo example with "react-native-router-flux": "4.0.0-beta.26" and "react-navigation": "1.5.8". From the main screen select "Go to Tabbar Page". The app crashes with the error listed in the title. I didn't know if I should have created a new issue or simply extend this one. I chose the latter, obviously.


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.

Your reply begs the question: When will 4.x be stabilized for production? Hitting a moving target while trying to get an app to market is risky business.
Also, upgrading to "react-native-router-flux": "4.0.0-beta.32" did not fix the problem.
simulator screen shot - iphone 6 - 2018-06-16 at 08 14 39

Was this page helpful?
0 / 5 - 0 ratings