title: react native - redirect screen after register on ajax success
body: <p>I am trying to redirect to another page after register, I am getting success response in the form of toast but after that navigation not working.
  I am getting error 
  <strong>undefined is not an object (evaluating 'this.props.navigate')</strong></p>
  
  <p>I tried call navigation using function but no luck.</p>
  
  <p>Register.js</p>
  
  <pre><code>handleSubmit(event){
       event.preventDefault();
       var data = {
          uname: this.state.uname,
          uemail: this.state.uemail,
          upass: this.state.upass
       }   
       fetch('http://spaceonerents.com/API/api/API/register/submit', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json'},
            body: JSON.stringify(data)
       }).then(function(response){
           Toast.show('You registered successfully');   
           this.props.navigation.navigate('Login');
       }).catch((error) =&gt; {
          console.error(error);
       });
     }
  </code></pre>
  
  <p>AppNavigator.js</p>
  
  <pre><code>import {createStackNavigator, createAppContainer, createDrawerNavigator} from 'react-navigation';
  import HomeScreen from './Home';
  import ProfileScreen from './Profile';
  import LoginScreen from './Login';
  import RegisterScreen from './Register';
  
  const AppssNavigator = createStackNavigator({
      Home : HomeScreen,
      Profile : ProfileScreen,
      Register : RegisterScreen,
      Login : LoginScreen
  },
  {
      initialRouteName: 'Home'
  });
  
  const AppNavigator = createDrawerNavigator({
      Home: AppssNavigator,
      Login: AppssNavigator,
  });
  
  export default createAppContainer(AppNavigator);
  </code></pre>
  
  <p>App.js</p>
  
  <pre><code>import React, {Component} from 'react';
  import AppNavigator from './components/AppNavigator';
  import {createAppContainer} from 'react-navigation';
  import {StyleSheet, Text, View, Button} from 'react-native';
  
  class App extends Component {
    render(){
      return (
        &lt;AppNavigator /&gt;
      );
    }  
  };
  
  const styles = StyleSheet.create({
  
  });
  
  export default App;
  </code></pre>
  
  <p>Thank you in advance</p>