title: undefined is not a function (evaluating 'navigation.dispatch')
body: <p>I am trying to navigate to the first page after user logout!
  and getting this error:</p>
  
  <blockquote>
    <p>undefined is not a function (evaluating 'navigation.dispatch').</p>
  </blockquote>
  
  <p>my action creator code is as follows:</p>
  
  <pre><code>import {NavigationActions} from 'react-navigation';
  import {AsyncStorage} from 'react-native';
  import {applyMiddleware as dispatch} from "redux";
  
  export const userRemove = (navigation) =&gt; {
      AsyncStorage.removeItem('user');
      const navigateAction = NavigationActions.navigate({
          routeName: 'First',
          props: {}
      });
      navigation.dispatch(navigateAction);
  };
  </code></pre>
  
  <p>I have called this action from sideBar of component. The component code is correct since that AsyncStorage.removeItem('user') is working correctly!
  sorry for bad grammar. I can't write in english better than this <a href="https://i.stack.imgur.com/AcilU.png" rel="nofollow noreferrer">error message here</a></p>
  
  <p>my component code here:</p>
  
  <pre><code>import React, {Component} from 'react';
  import {
      Container,
      Content,
      Footer,
      FooterTab,
      Button,
      Icon
  } from 'native-base';
  import {userRemove} from '../actions/sideBarAction';
  import {connect} from "react-redux";
  import {bindActionCreators} from "redux";
  
  class SideBar extends Component {
      constructor(props) {
          super(props);
      }
  
      logout() {
          userRemove(this.props.navigation);
      }
  
      render() {
          return (
              &lt;Container&gt;
                  &lt;Content&gt;
                      ...
                  &lt;/Content&gt;
                  &lt;Footer&gt;
                      &lt;FooterTab&gt;
                          &lt;Button onPress={this.logout.bind(this)}&gt;
                              &lt;Icon name="logout"/&gt;
                          &lt;/Button&gt;
                      &lt;/FooterTab&gt;
                  &lt;/Footer&gt;
              &lt;/Container&gt;
          )
      }
  }
  
  const mapStateToProps = state =&gt; {
      return {
          username: state.home.username,
          password: state.home.password,
          score: state.home.score,
      }
  };
  const mapDispatchToProps = dispatch =&gt; {
      return Object.assign({dispatch: dispatch}, 
      bindActionCreators(userRemove, dispatch));
  };
  
  connect(mapStateToProps, mapDispatchToProps)(SideBar);
  </code></pre>