React-native-router-flux: How to go back to Login again?

Created on 15 Jan 2017  路  2Comments  路  Source: aksonov/react-native-router-flux

Version

Tell us which versions you are using:

  • react-native-router-flux v3.37.0
  • react-native v0.40.0

Expected behavior

render() {
return(




    </Scene>
  </Router>
);

}

I want it to go back to Login screen when an Item clicked from Drawer

logout(){
Actions.login({type: 'reset', data:obj});
}

2 questions:

  1. on Actions.login({type: 'reset', data:obj}); it is not going back to login screen
  2. Why I have to add my component {Home} under another scene (an extra level)

I am using it for the first time any help really appreciated.

Thanks

Most helpful comment

If your app is guaranteed to pass the login screen, Actions.popTo('login') will work. Otherwise run the Actions.login without the type attribute, and set that as the type on the login <Scene /> in your router, which will reset the nav stack whenever the user ends up on the login screen.

All 2 comments

If your app is guaranteed to pass the login screen, Actions.popTo('login') will work. Otherwise run the Actions.login without the type attribute, and set that as the type on the login <Scene /> in your router, which will reset the nav stack whenever the user ends up on the login screen.

@davidsharp worked perfect. This is probably the simplest solution the people over in https://github.com/aksonov/react-native-router-flux/issues/857 were looking for

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xnog picture xnog  路  3Comments

sylvainbaronnet picture sylvainbaronnet  路  3Comments

basdvries picture basdvries  路  3Comments

wootwoot1234 picture wootwoot1234  路  3Comments

maphongba008 picture maphongba008  路  3Comments