title: onStateChange on NavigationContainer with undefined param
body: <p>I'm using a <code>NavigationContainer</code> inside a <code>NavigationContainer</code> with React Navigation 5. Before that, I was testing with a <code>NavigationContainer</code> from navigation 5 inside a <code>createAppContainer</code> in navigation 4 and it worked normally.</p>
  
  <p><strong>The problem is</strong>: when my second NavigationContainer calls the <code>onStateChange</code> function, the received parameter is undefined. In addition, when using a ref, the <code>getRootState</code> method also returns undefined. I can use the ref to navigate between screens and also call the goBack function normally.</p>
  
  <p>An example code:</p>
  
  <pre><code>const navigationRef = React.useRef();
  </code></pre>
  
  <p>The second navigation:</p>
  
  <pre><code>&lt;NavigationContainer
    independent={true}
    ref={navigationRef}
    onStateChange={navigationChanged}
  &gt;
    &lt;BusinessNavigation /&gt;
  &lt;/NavigationContainer&gt;;
  </code></pre>
  
  <p>Works fine:</p>
  
  <pre><code>navigationRef.current.resetRoot({
    routes,
    index: 0
  });
  </code></pre>
  
  <pre><code>navigationRef.current.goBack();
  </code></pre>
  
  <p>problems:</p>
  
  <pre><code>navigationRef.current.getRootState(); //returns always undefined
  </code></pre>
  
  <pre><code>const navigationChanged = (params: any) =&gt; {
    console.log(params); //is undefined
  };
  </code></pre>