title: How to move between tab screens in tab navigator in react navigation 5?
body: <pre><code>&lt;NavigationContainer&gt;
        &lt;Tabs.Navigator&gt;
          &lt;Tabs.Screen name=&quot;Home&quot; component={HomeStack} /&gt;
          &lt;Tabs.Screen name=&quot;Discover&quot; component={Discover} /&gt;
        &lt;/Tabs.Navigator&gt;
      &lt;/NavigationContainer&gt;
  </code></pre>
  <p>I have a search component in Home Stack... And I have a search button in discover which takes me to search component in Home stack
  but when I use <code>navigator.back()</code> it took me to the home component instead of discover the component
  The Stack navigator in HomeStack is like this:</p>
  <pre><code>&lt;Stack.Navigator initialRouteName=&quot;HomeScreen&quot;&gt;
        &lt;Stack.Screen
          name=&quot;HomeScreen&quot;
          component={HomeScreen}
        /&gt;
        &lt;Stack.Screen
          name=&quot;SearchScreen&quot;
          component={SearchScreen} // this is the search component
        /&gt;
      &lt;/Stack.Navigator&gt;
  </code></pre>
  <p>I want the back button to take me to the last screen instead of the root screen of that stack</p>