title: Non-serializable values were found in the navigation state. Check: Login > params.store.dispatch (Function)
body: <p>If I log in then I close application (and I have data saved in AsyncStorage) I get no errors when I'm trying to log out, but if I clear all cache/data from app and I try to login then to logout I have error:
  <strong>Non-serializable values were found in the navigation state.</strong></p>
  <p>Index.js (extracted from file)</p>
  <pre><code>import { createStore } from 'redux'
  
  function DrawerNavigator(props) {
    return (
      &lt;Drawer.Navigator&gt;
        &lt;Drawer.Screen name=&quot;Profile&quot; component={Profile} initialParams={{ store, logged: props.route.params.logged, userlevel: props.route.params.userlevel, usertype: props.route.params.usertype }} /&gt;
      &lt;/Drawer.Navigator&gt;
    );
  }
  
  export default class App extends Component {
    constructor( ) {
          super()
          this.state = {
            logged: null,
            loading: true,
            userlevel: null,
            usertype: null,
          }
    }
  
    componentDidMount = async () =&gt; {
      this.getData();
      this.getToken();
    }
  
    getToken = async () =&gt; {
       store.subscribe(() =&gt; this.setState({ logged: store.getState() }))
    }
  
    getData = async () =&gt; {
  
      try {
        const value = await AsyncStorage.getItem('token')
        
  
        if(value !== null) {
  
          const myuser = await AsyncStorage.getItem('user')
  
          await axios.post(
            &quot;api/usercheck&quot;,
            {
              username: myuser,
            },
            {
            headers: {
              &quot;Accept&quot;: &quot;application/json&quot;,
              &quot;Content-Type&quot;: &quot;application/json&quot;,
              }
            },
          )
          .then ((res) =&gt; {
            JSON.stringify(res);
            if (res.data.success === true) {
  
              this.setState({ 'logged': value, 'loading': false, 'userlevel': res.data.userlevel, 'usertype': res.data.usertype })
  
              store.dispatch({ type: 'OVERWRITE', payload: value }) //Redux Token
            }
            else {
              if (res.data.success === false) {
                alert ('User verification error.');
              }
              alert('User verification error.');
            }  
          })
          .catch(error =&gt; {
            console.log(error);
            alert('No connection!');
          })
          .done()
            } else {
          this.setState({ loading: false })
        }
      } 
      catch(e) {
        console.log(e)
      }
      
  }
  
  render() {
  
      if( this.state.loading ) {
        return (
          &lt;&gt;
          &lt;View style={{flex: 1, justifyContent: 'center', }}&gt;
            &lt;ActivityIndicator size=&quot;large&quot; color=&quot;#ff0000&quot; /&gt;
            &lt;Text style={{textAlign: 'center', marginTop: 15 }}&gt;Loading...&lt;/Text&gt;
          &lt;/View&gt;
          &lt;/&gt;
        )
      }
      
      return(
      &lt;&gt;
        &lt;StatusBar
              backgroundColor=&quot;#EE3A43&quot;
              barStyle=&quot;light-content&quot;
        /&gt;
        &lt;NavigationContainer&gt;
        {!this.state.logged ? (
          &lt;Stack.Navigator screenOptions={{ headerShown: false }}&gt;
            &lt;Stack.Screen name=&quot;Login&quot; component={Login} initialParams={{ store, storeLevel, storeType }} /&gt;
          &lt;/Stack.Navigator&gt;
          
          ) : (
  
            &lt;Stack.Navigator screenOptions={{ headerShown: true }}&gt;
              &lt;Stack.Screen name=&quot;DrawerNavigator&quot; component={DrawerNavigator} initialParams={{ logged: this.state.logged, userlevel: this.state.userlevel, usertype: this.state.usertype }} /&gt;
            &lt;/Stack.Navigator&gt;
          
          )
        }
        &lt;/NavigationContainer&gt;
        
      &lt;/&gt;
      )
    }
  }
  
  
  </code></pre>
  <p>Login.js screen (login function)</p>
  <pre><code>login = async () =&gt; {
          if(this.state.username == '' || this.state.password == '' ) {
              alert('Fill username and password input.');
          } 
          else {
              axios.post(
                  &quot;api/login&quot;,
                  {
                      username: this.state.username,
                      password: this.state.password,
                  },
                  {
                  headers: {
                     &quot;Accept&quot;: &quot;application/json&quot;,
                     &quot;Content-Type&quot;: &quot;application/json&quot;,
                      }
                  },
              )
              .then ((res) =&gt; {
                  JSON.stringify(res);
  
                  if (res.data.success === true) {
                      var mytoken = String(res.data.token)
                      AsyncStorage.setItem('user', res.data.user)
                      AsyncStorage.setItem('token', res.data.token)
  
                      this.props.route.params.store.dispatch({ type: 'OVERWRITE', payload: mytoken })
                  }
                  else {   
                      console.log(res.data)
                      alert(res.data.message)
                  }    
              })
              .catch(error =&gt; {
                  alert('No connection!');
              })
              .done()
              
          }
  
      }
  </code></pre>
  <p>Profile Screen (logout function)</p>
  <pre><code>logout = async () =&gt; {
          try {
              AsyncStorage.removeItem('user')
              AsyncStorage.removeItem('token')
              this.props.route.params.store.dispatch({ type: 'OVERWRITE', payload: null })
  
          } 
          catch(e) {
            console.log(e)
          }
      }
      
  </code></pre>