title: React navigation different route params on same route
body: <p>I have a route in my app that can be navigated to from two different locations. </p>
  
  <p>Specifically:</p>
  
  <p>Home screen (StackNavigation) -> target route</p>
  
  <p>Tab navigation -> target route</p>
  
  <p>I have noticed that react navigation re-uses the same target route component (does not re-mount) regardless of which way the target route is navigated too. </p>
  
  <p>Unfortunately, this means that route params are always the same as the first method used to navigate to the target route.</p>
  
  <p>I would like to focus an input search box when the target route is navigated to from the home screen, but not when navigated via tab navigation.</p>
  
  <p>Initially I was using this code:</p>
  
  <pre><code>useEffect(() =&gt; {
      const _focusSearchBar = (payload) =&gt; {
          if (props.navigation.getParam('shouldFocus') &amp;&amp; searchBar &amp;&amp; searchBar.current) {
              searchBar.current.focus();
          }
      }
      let focusSub = props.navigation.addListener('didFocus', _focusSearchBar);
      _focusSearchBar();
      return () =&gt; focusSub.remove();
  }, []);
  </code></pre>
  
  <p>How can I achieve this? Also the target route loads data, so it is probably a good thing that it doesn't remount... </p>
  
  <p>In essence I need a way of determining how the route was navigated too, through the home screen or via tab navigation.</p>
  
  <p>Thanks!</p>