简体   繁体   中英

How to insert new scene on pop stack in react native?

I am working on existing react native project and I want to find solution for pop action on navigation stack where I want to introduce new scene which is actually not on stack.

I have three different type of route based on state of user logged In, logged out or in locked state. So while user's app state is locked at that time on launch I am directing user to reset account page from launch scene.

Launch Scene -> Reset Account

But on back event of Reset Account, I want to show login page instead of Launch scene, but Login scene is not in stack as of now.

So how to insert new scene when user performs pop action ?

I am new to react native and I don't know how to modify navigation stack programmatically without performing any animation ?

In my project there is one package named react-native-router-flux to handle react navigation.

Any insight will be helpful.

I suggest you create a SwitchNavigator between LaunchScreen and AccountStack

AccountStack is a StackNavigator that render both:

  • LoginScreen.
  • ResetAccountScreen. << This would be your initialRoute.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM