title: React Native, "setState() on unmounted component" warning
body: <p>I have a working piece of code that triggers warning (the code should login to the REST and turn off Activity Indicator). I don't understand how my component could be unmounted as I bind onLoginPressed on button tap, after all possible mounts should already be finished. Please help me to get rid of it and understand the cause of the warning...<br>
  UPD: Thanks to the comments I figured out that component is unmounted and componentWillUnmount is invoked... But I don't understand why and when it is happening...</p>
  
  <blockquote>
    <p>"Warning: setState(...): Can only update a mounted or mounting
    component. This usually means you called setState() on an unmounted
    component. This is a no-op. Please check the code for the undefined
    component."</p>
  </blockquote>
  
  <p>Here is my code, warning is triggered by second <code>setState</code>:</p>
  
  <pre class="lang-js prettyprint-override"><code>onLoginPressed(){
      console.log('Attempted to login with: '+this.state.username);
      this.setState({showProgress: true});
  
      AuthService.login({
        login: this.state.username,
        password: this.state.password
      }, (results)=&gt; {
        this.setState(Object.assign({ // have to create a solid Object with all states to be changed at once
          showProgress: false // turning off ActivityIndicator
        }, results));
  
        if(results.success &amp;&amp; this.props.onLogin){
          this.props.onLogin(); // Yey! We logged in! Let's move to the next View
        }
      });
    }
  </code></pre>
  
  <p>...
  AuthService.js:</p>
  
  <pre class="lang-js prettyprint-override"><code>login (creds, callback) {
      fetch(CFG.AUTH_URL)
        .then((response)=&gt; {
          if((response.status &gt;= 200) &amp;&amp; (response.status &lt; 300)){
            return response.json();
          }
          throw {
            serverError: (response.status == 500) || (response.status == 501),
            unknownError: (response.status != 500) || (response.status != 501)
          };
        })
        .then((result)=&gt; {
            AsyncStorage.multiSet([ // Have to save login+password and session_hash for later use...
              [authKey, JSON.stringify(creds)],
              [sessionKey, result.data.session_hash]
            ], (err)=&gt; {
              if (err) throw err;
            });
            return callback({success: true});
        }
        })
        .catch((err)=&gt; {
          return callback(err);
        });
    }// end of login
  </code></pre>