title: onesignal with react-navigation and redux: i am not able to navigate to screen when notification is opened
body: <p><strong>The problem:</strong><br>
  I need to navigate to a screen when the onesignal notification is opened.</p>
  
  <p><strong>The situation:</strong><br>
  I can not navigate from my App component cause the navigator is not yet defined.<br>
  I can not navigate from my RootContainer component cause the navigator is not yet defined.  </p>
  
  <p>I thought about dispatch action instead of navigate, but the same:<br>
  I can not dispatch action from my App component cause the store is not yet defined.<br>
  I can not dispatch action from my RootContainer component cause the navigation is not yet defined.</p>
  
  <p>This is the App.js:</p>
  
  <pre><code>... import
  
  const persistConfig = {
      key: 'root',
      version: 1,
      storage,
      blacklist: ['navigation']
  };
  
  const persistedReducer = persistReducer(persistConfig, reducer);
  
  const store = createStore(persistedReducer, {
      is_logged_in: false,
      login_type: null,
      access_token: null
  },
      applyMiddleware(logger));
  
  const persistor = persistStore(store);
  class App extends Component {
  
      constructor(props) {
          super(props);
  
          OneSignal.init("...");
  
          this.onOpened = this.onOpened.bind(this);
  
          OneSignal.addEventListener('received', this.onReceived);
          OneSignal.addEventListener('opened', this.onOpened);
          OneSignal.addEventListener('ids', this.onIds);
  
          this.state = {
              notification_offer_clicked: null
          };
      }
  
      componentWillUnmount() {
          OneSignal.removeEventListener('received', this.onReceived);
          OneSignal.removeEventListener('opened', this.onOpened);
          OneSignal.removeEventListener('ids', this.onIds);
      }
  
      onOpened(openResult) {
          this.setState({
              notification_offer_clicked: openResult.notification.payload.additionalData.offer
          });
      }
  
      render () {
          return (
              &lt;Provider store={store}&gt;
                  &lt;PersistGate loading={null} persistor={persistor}&gt;
                      &lt;RootContainer notification_offer_clicked={this.state.notification_offer_clicked} /&gt;
                  &lt;/PersistGate&gt;
              &lt;/Provider&gt;
          )
      }
  }
  
  export default DebugConfig.useReactotron
    ? console.tron.overlay(App)
    : App
  </code></pre>
  
  <p>As you can see I try to pass <code>notification_offer_clicked</code> prop to RootContainer to propagate the event.<br>
  The prop is correctly passed, but I do not know howto go on from there.</p>
  
  <p>This is Container.js:  </p>
  
  <pre><code>... import
  
  class RootContainer extends Component {
      shouldComponentUpdate(nextProps, nextState) {
          //if (nextProps.notification_offer_clicked) {
          //    this.props.navigation.navigate('Offer', { 'offer' : nextProps.notification_offer_clicked });
          //}
          return true;
      }
  
      render() {
          return (
              &lt;AppNavigator /&gt;
          );
      }
  }
  
  const mapStateToProps = (state) =&gt; {
      return {
          is_logged_in: state.is_logged_in,
      };
  };
  
  // wraps dispatch to create nicer functions to call within our component
  const mapDispatchToProps = (dispatch) =&gt; ({
      startup: () =&gt; dispatch(StartupActions.startup())
  });
  
  export default connect(mapStateToProps, mapDispatchToProps)(RootContainer)
  </code></pre>
  
  <p><code>AppNavigator</code> is a <code>StackNavigator</code> variable, so I do not know howto (and if its possible) pass props to it.  </p>
  
  <p>The problem is if I try to decomment </p>
  
  <blockquote>
    <p>this.props.navigation.navigate...</p>
  </blockquote>
  
  <p>line I get the error cause <code>navigation</code> is not yet defined in the RootContainer. </p>
  
  <p>My question is: how can I navigate to a screen (or simply dispatch a redux action) when I open a onesignal notification?</p>