title: How to set other first screen when I am logged in
body: <p>How can I choose according value in AsyncStorage which screen should be displayed? I don't know why setting screen value 'Home' to InitialScreen variable doesn't work?</p>
  
  <p>Once I log in <strong>login.js</strong> screen and I close app, after launching the app again I am navigated to <strong>login.js</strong>. But now I want to go to <strong>home.js</strong> screen.</p>
  
  <p>Parent's file <strong>routes.js</strong>:</p>
  
  <pre><code>let InitialScreen
  const RoutesNavigation = StackNavigator({
      Login: { screen: Login },
      Home: { screen: Home }
  }, {
          initialRouteName: InitialScreen,
          navigationOptions: {
              header: false,
          }
      });
  
  
  export default class App extends Component {
      constructor(props) {
          super(props);
          value = AsyncStorage.getItem('name');
          if (value !== null) {
              InitialScreen = 'Home'; //This doesn't change Initial screen!!!
              console.log("JJJJJJJJJJJJJJJJJJ routes.js value !== null ");
          }
      }
      render() {
          return (
              &lt;RoutesNavigation /&gt;
          );
      }
  }
  </code></pre>
  
  <p>This is <strong>login.js</strong>, where I store value from received json:</p>
  
  <pre><code>export default class Login extends Component {
  
      constructor(props) {
          super(props);
          this.state = {
              username: '',
              password: '',
          }
      }    
  
      render() {
          return (
              &lt;View style={styles.container}&gt;
  
                  &lt;TextInput
                      style={styles.textInput} placeholder='Username'
                      onChangeText={(username) =&gt; this.setState({ username })}
                      underlineColorAndroid='transparent'
                  /&gt;
  
                  &lt;TextInput
                      style={styles.textInput} placeholder='Password'
                      onChangeText={(password) =&gt; this.setState({ password })}
                      secureTextEntry={true}
                      underlineColorAndroid='transparent'
                  /&gt;
  
                  &lt;TouchableOpacity
                      style={styles.btn}
                      onPress={this.login}&gt;
                      &lt;Text&gt;Log in&lt;/Text&gt;
                  &lt;/TouchableOpacity&gt;
  
              &lt;/View&gt;
          );
      }
  
      login = () =&gt; {
  
          var formData = new FormData();
          formData.append('userName', this.state.username);
          formData.append('password', this.state.password);
  
          fetch('http://....', {
              method: 'POST',
              body: formData
          })            
              .then((response) =&gt; response.json())
              .then((responseJson) =&gt; {
                  console.log("JJJJJJJJJJJJJJJJJJJJJJJJJ name: " + responseJson.name);
                  AsyncStorage.setItem('name', responseJson.name);
                  this.props.navigation.navigate('Home');
              })
              .catch(()  =&gt; {
                  console.log("JJJJJJJJJJJJJJJJJJ Wrong connection");
                  alert('Wrong connection');
              })
      }
  }
  </code></pre>
  
  <p>This is <strong>home.js</strong>:</p>
  
  <pre><code>export default class Home extends Component {
      render() {
          return (
              &lt;View style={styles.container}&gt;
  
                  &lt;Text style={styles.text}&gt; Member area. You are logged in. &lt;/Text&gt;
  
                  &lt;TouchableOpacity
                      style={styles.btn}
                      onPress={this.logout}&gt;
                      &lt;Text&gt;Log out&lt;/Text&gt;
                  &lt;/TouchableOpacity&gt;
  
              &lt;/View&gt;
          );
      }
  
      logout = () =&gt; {
  
          AsyncStorage.removeItem('name');
          this.props.navigation.navigate('Login');
          console.log("JJJJJJJJJJJJJJJJJJ Logged out");
  
      }
  
  }
  </code></pre>