title: How can i use react-navigation in class method?
body: <pre><code>import * as React from 'react';
  import { createAppContainer, createSwitchNavigator } from 'react-navigation';
  import { createStackNavigator } from 'react-navigation-stack';
  import { Text, View } from 'react-native';
  
  
  class LoadingScreen extends React.Component {
    dataCheck = () =&gt; {
      for (i = 0; i &lt; 5; i++) { // data loading time in real code
        if (i == 4) {
          this.props.navigation.navigate('AppStack')
        }
      }
    }
    render() {
      return (
        &lt;View&gt;
          &lt;Text&gt;loading&lt;/Text&gt;
          {this.dataCheck}
        &lt;/View&gt;
      );
    }
  }
  
  class MainScreen extends React.Component {
    render() {
      return (
        &lt;View&gt;
          &lt;Text&gt;mainscreen&lt;/Text&gt;
        &lt;/View&gt;
      );
    }
  }
  
  
  const AppNavigator = createStackNavigator(
    {
      main: MainScreen
    },
    {
      initialRouteName: 'main'
    }
  )
  
  const LoadNavigator = createSwitchNavigator(
    {
      load: LoadingScreen,
      AppStack: AppNavigator
    },
    {
      initialRouteName: 'load'
    }
  )
  
  export default createAppContainer(LoadNavigator)
  </code></pre>
  <p>I am trying to show loading screen while loading data. So I wrote method 'dataCheck' in class 'LoadingScreen' which waits until data is loaded(for statement in code above) and navigates to 'AppStack'.
  But I think &quot;this.props.navigation.navigate('AppStack')&quot; doesn't work. How can I use react-navigation in class's method?</p>