title: React Navigation TabNavigator: Reset previous tab on tab change
body: <p>I have the following route structure:</p>
  
  <pre><code>StackNavigator
  -StackNavigator
  -TabNavigator
  --Tab1
  ---Route 1 (Stack) (initial)
  ---Route 2 (Stack)
  
  --Tab2
  ---Route 3 (Stack) (initial)
  ---Route 4 (Stack)
  </code></pre>
  
  <p>When I visit <code>Tab1 -&gt; Route 1 -&gt; Route 2 -&gt; Tab2</code> and go back to <code>Tab1</code>, the active route is 2 instead of the <code>initialRoute</code> 1.</p>
  
  <p>I'm doing the following:</p>
  
  <pre><code>tabBarOnPress: ({ scene }) =&gt; {
      const { route } = scene;
      const tabRoute = route.routeName;
      const { routeName } = route.routes[0];
  
      navigation.dispatch(NavigationActions.navigate({ routeName: tabRoute }));
  
      navigation.dispatch(NavigationActions.reset({
          index: 0,
          actions: [
              NavigationActions.navigate({ routeName }),
          ],
      }));
  },
  </code></pre>
  
  <p>but the problem is that it first shows <code>Route 2</code> and then navigate to <code>Route 1</code>.</p>
  
  <p>How can I reset the previous tab/screens, so when I switch the tab always to show directly the initial route.</p>