title: Resetting React Stack Navigator from Another Stack
body: <p>I have an issue with resetting Stack Navigator when inside another Stack navigator, here's the scenario:</p>
  
  <ol>
  <li>User lands on Book List screen</li>
  <li>User navigates to Book Detail screen</li>
  <li>User switches to Settings screen through bottom navigation / tabs</li>
  <li>User switches the account</li>
  </ol>
  
  <p>When user switches the account, I need to clear Books navigation stack, so that navigating back to Books stack through the bottom tab navigation doesn't show a screen/book detail that no longer belongs to the active account.</p>
  
  <p>I suspect this can be achieved using the <code>target</code> property, I'm just not sure what to feed into it. The documentation says it's the key of the navigator which contains the route (<a href="https://reactnavigation.org/docs/navigation-actions/#goback" rel="nofollow noreferrer">https://reactnavigation.org/docs/navigation-actions/#goback</a>).</p>
  
  <pre><code>this.props.navigation.dispatch({
    target: ???,               &lt;-- how can I point this to the Books stack?
    ...CommonActions.reset({
       index: 1,
       routes: [
         { name: 'book-list' }
       ]
     })
  });
  </code></pre>
  
  <p>However, putting in <code>target: 'books'</code>, which is the key of the Books tab navigator produces the following error:</p>
  
  <pre><code>The action 'RESET' with payload '{"index":1,"routes":[{"name":"book-list"}]}' was not handled by any navigator. If you are trying to navigate to a screen, check if the screen exists in your navigator.
  </code></pre>
  
  <p>This is the navigation structure:</p>
  
  <pre><code>NavigationContainer
  --Tab.Navigator
  ----Tab.Screen (Books)
  ------Stack.Navigator
  --------Stack.Screen (Book List)
  --------Stack.Screen (Book Detail)
  ----Tab.Screen (Settings)
  ------Stack.Navigator
  --------Stack.Screen (Settings Page)
  </code></pre>
  
  <p>Ideally, I would want to reset the Books navigator stack after the user switches the account and don't navigate to Books.</p>