title: React Native fetch promise .then() not executing immediately
body: <p>I'm using React Native to build an app for iOS and Android. In there, I'm simply calling fetch function from an external function once a button is tapped. The fetch function sends a POST request to a link and gets back a JSON response (JSON is correct, tested with Postman in various ways).</p>
  
  <p>The issue is that the code after .then() is not executed immediately, but after I tap on the screen or go back using the navigation or perform some sort of minor actions. Here's the code that I used:</p>
  
  <p><strong>CALLING CODE FROM FUNCTION</strong></p>
  
  <pre><code>verify() {
    this.setState({
      pressed: true
    });
  
    var self = this;
    var theURL = "&lt;URL&gt;"; //Removed for question
  
    fetch(theURL, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        uidOrEmail: this.state.email,
        code: this.state.value
      })
    })
  .then(res =&gt; res.json())
  .then(function(data) {
    console.log(data); //PROBLEM: This doesn't execute immediately
  }
  </code></pre>
  
  <p><strong>BINDING</strong>
  I'm also binding this function in the constructor like this:</p>
  
  <pre><code>constructor(props) {
    super(props);
    console.log(this.props.navigation.state.params.email);
  
    this.state = {
      email: props.navigation.state.params.email,
      value: '',
      pressed: false
    };
  
    this.verify = this.verify.bind(this);
  }
  </code></pre>
  
  <p><strong>INVOKING FUNCTION FROM UI</strong></p>
  
  <pre><code>&lt;Button
    disabled={this.state.pressed}
    onPress={this.verify}
    &gt;{!this.state.pressed ? 'Verify' : 'Verifying...'}&lt;/Button&gt;
  </code></pre>
  
  <p><em>To summarize:</em> Fetch function not resolving promise immediately.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Some more information:</p>
  
  <p>The fetch link is actually a Firebase function's link. How that function is returning:</p>
  
  <pre><code>response.status(200).send({status: 200, token: "ABC"});
  </code></pre>