1

I have a Login Page(StackNavigator) and a Tabbed pages(TabNavigator).

export const Root = StackNavigator({
  LoginScreen: {screen: Login},
  Tabs: {screen: Tabs}
},
  {
  initialRouteName: 'LoginScreen'
  }
)

After logging the user in there is still a possibility for the user to go back(to Login Page) by swiping back. What is the way of popping the login route from the Route Stack or disabling the back swipe option. Thanks

Nikasv
  • 1,077
  • 3
  • 16
  • 30

1 Answers1

2

Dispatch a reset action instead of the normal navigation dispatch. That way you can set the stack to the state you want it to be after logging in and remove your LoginScreen from the stack.

Example related answers:

Michael Cheng
  • 8,995
  • 6
  • 42
  • 47