title: React native TypeError: Network request failed with fetch()
body: <p>I'm using React native for developing an android application. With this fetch request I'm getting the error <code>TypeError: network request failed</code>:</p>
  
  <pre><code>fetch('https://pixabay.com/api/?key=MY_KEY&amp;q='+ this.props.jsondata.city.name +'&amp;lang=en&amp;image_type=photo&amp;orientation=horizontal&amp;category=travel&amp;safesearch=true')
          .then(response =&gt; {
              console.dir(response);
              if (!response.ok) {
                  throw Error(data.statusText);
              }
              return response.json();
          })
          .then(json =&gt; {
              console.log(json.hits[0].largeImageURL)
              this.setState(() =&gt; {
                  return {backImage: json.hits[0].largeImageURL};
              });
          })
          .catch(err =&gt; {
              console.log('Unable to search image! ' + err);
          });
  </code></pre>
  
  <p>I've already searched online but this problem appears only with localhost addresses or http, that is not my case. The request is inside the <code>componentDidMount()</code> function. I've made a similar request (with the same structure) in an another place of the application but there is no error there. I'm using a real android device to testing the app with the react-native app compiled in android native code.</p>