1

I've created a Snack for this: https://snack.expo.io/HJebCIoiM

The problem is really simple, but most issues I've found on GH and SO are about the opposite behaviour: resetting the StackNavigator to its initial route when switching between items in the DrawerNavigator.

App structure

  • Drawer
    • Router
      • First screen
      • Second screen
    • Other screen

The initial route is Router, which by default shows the first screen.

Current behaviour

  1. I go from the first screen to the second screen
  2. I toggle the drawer
  3. I go to the other screen in the drawer
  4. I go back to the Router
  5. It shows the first screen

Expected behaviour:

In step 5. it should show the second screen, because that's the last route I was on when I toggled the DrawerNavigator.

I don't understand why it doesn't preserve the state of the stack, and just takes me back to the screen I was on before, but instead resets the stack to its initial route.

What confuses me even more is that many people are reporting that this is the default behaviour of their app, but they do want to reset the stack and are struggling with this:

I don't understand why it does reset it all the time in my case. (and as you should be able to reproduce with the Snack I posted above.

Marcel Kalveram
  • 1,295
  • 1
  • 14
  • 22

0 Answers0