title: react native navigation after checking the authStatechanged using firebase
body: <p>i'm try to start my application on a loadingScreen where it would check if there's any session with firebase, 
  here's the code i tried so many version but nothing works which in my view is a lack of understanding to scope in JS</p>
  
  <p>version 2</p>
  
  <pre><code>//importing 
  import {f,fAuth} from '../../config'
  
  class Loading extends React.Component {
  componentDidMount(){
  
          f.auth().onAuthStateChanged((user)=&gt;{console.log(user);this.nav(user) })
  
      }
  
      nav(user)
      {   
          console.log(user)
          if (user===null){
              console.log(user)
              // to login page
              this.props.navigation.navigate('auth')
          }
          else{
              console.log(user)
              // to home page
              this.props.navigation.navigate('main')
          }
      }
  }
  
  </code></pre>
  
  <p>version 1</p>
  
  <pre><code>componentDidMount(){
          f.auth().onAuthStateChanged(user=&gt;{th.props.navigation.navigate(user ?'main':'auth')})    
      }
  
  
  </code></pre>
  
  <p>in the config file </p>
  
  <pre><code>import firebase from 'firebase';
  
  var firebaseConfig = {
      apiKey: "AIzaSyDYcY1wXll4JI3Gb-qokG6F6KQZB5zzrkg",
      authDomain: "insta-12594.firebaseapp.com",
      databaseURL: "https://insta-12594.firebaseio.com",
      projectId: "insta-12594",
      storageBucket: "insta-12594.appspot.com",
      messagingSenderId: "898455527488",
      appId: "1:898455527488:web:6a749552a9401905de0eec5"
    };
    // Initialize Firebase
    firebase.initializeApp(firebaseConfig)
  
  export const  f = firebase;
  export const fDb= firebase.database()
  export const fAuth= firebase.auth()
  
  
  </code></pre>