title: React native: undefined is not an object(evaluating 'this.props.navigation.navigate')
body: <p>First of all, I found many questions with the same problem, yet none have seemed to help me. The code does reach the <code>this.props.navigation.navigate('LoginScreen')</code> but after throws the error seen in the title. The documentation states that you can just use <code>this.props</code> but it seems to be undefined. I also tried to just use <code>props.navigation</code> and even destruct navigation inside the <code>checkedIfLogginIn</code> as a parameter like this <code>checkIfLoggedIn = ({ navigation }) =&gt; {}</code>. Maybe it is a small thing im overseeing but the problem has been me for quiet a while now and I need it fixed. </p>
  
  <pre><code>import React, { Component } from 'react';
  import { StyleSheet, Text, View, Alert } from 'react-native';
  import{ createAppContainer, createSwitchNavigator } from 'react-navigation';
  import { createStackNavigator } from 'react-navigation-stack';
  import LoginScreen from './Components/LoginScreen';
  import firebase from './firebase';
  
  class App extends Component{
  
   checkedIfLoggedIn = () =&gt; {
    firebase.auth().onAuthStateChanged(user =&gt; {
     if (user) {
       this.props.navigation.navigate(AppStackNavigator);
     } else {
       this.props.navigation.navigate('LoginScreen');
     }
    })
   }
  
   componentDidMount(){
     this.checkedIfLoggedIn();
   }
  
   render() {
     return &lt; AppContainer /&gt;;
   }
  }
  
  export default App
  </code></pre>