Description
Hey guys, I'm currently building a react-native app using expo. It has been running successfully on some android phones for a while not until I tried it on an android phone and it wasn't making network requests. I'm using "FETCH Api" and I clearly don't know why this should be happening.
I don't know if its an android target sdk thing or just a normal configuration thing. I need help
React Native version:
React Native Environment Info:
System:
OS: Windows 7
CPU: (4) x64 Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz
Memory: 1.46 GB / 5.91 GB
Binaries:
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.0.0.0 AI-171.4443003
Important details in the package.json :
"expo": "^32.0.0",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"@babel/core": "^7.0.0",
"@expo/vector-icons": "^9.0.0",
"babel-polyfill": "^6.26.0",
"expr-eval": "^1.2.1",
Steps To Reproduce
- expo build:android
Describe what you expected to happen:
I expected the app to success fully make a fetch request
Snack, code example, or link to a repository:
Here's how the fetch request looks like
fetchUsers = () => {
AsyncStorage.getItem('tellerId').then((token) => {
var RMid= token;
this.setState({ loading: true });
fetch(Url+endpoint+RMid,{
headers: {
'cache-control': 'no-cache',
'content-type': 'application/json',
accept: 'application/json' },
})
.then((response) => response.json())
.then((res) => {
if (res.error) {
console.log(res.error);
}
else {
try{
this.setState({ data: res, loading: false, });
if (this.state.data.length === 0) { this.setState({ listEmpty: 'Nothing yet' }); }
console.log(this.state.data)
}
catch (e) {
alert("Network Problem, Please Try Agian Later")
console.error(e.message);
}
}
})
.catch((error) => {
console.log(error);
})
.done();
});
}