expo / ex-navigation

Route-centric navigation for React Native
997 stars 201 forks source link

immediatelyResetStack not working #404

Closed niftylettuce closed 7 years ago

niftylettuce commented 7 years ago

Got a button, click it, runs this func

_handleLogout = () => {
    const { setUser } = this.context;
    setUser();
    this.props.navigation.getNavigator('drawer').toggleDrawer();
    this.props.navigation.getNavigator('drawer').immediatelyResetRouteStack(
      [ Router.getRoute('drawer') ], 0
    );
    this.props.navigation.getNavigator('master').immediatelyResetRouteStack(
      [ Router.getRoute('map') ], 0
    );
    Alert.alert('Logout', 'You have successfully logged out');
  };

Okay so it doesn't work, error screenshot below.

Basically I just want to reset the stacks of the navigators for both drawer and the main master one for my views. Looked elsewhere, saw nothing. Readme isn't documented on this usage really.

screen shot 2017-01-30 at 8 45 57 pm

niftylettuce commented 7 years ago

looks like my var is undefined, let me check more..

niftylettuce commented 7 years ago

TYPO immediatelyResetRouteStack -> immediatelyResetStack