i am using:
"react-native": "0.63.3",
"axios": "^0.21.0",
"react": "16.13.1",
and this is simple request to see if sending request is successful or not:
useEffect(() => {
console.log('log here fast');
axios
.get('http://api.github.com/users/hacktivist123/repos')
.then(function (response) {
console.log('axios', response);
})
.catch(function (error) {
console.log('axios error', error);
});
fetch('http://api.github.com/users/hacktivist123/repos')
.then((response) => response.json())
.then((data) => console.log(data));
console.log('log here slow');
}, []);
and it's not even showing if request has been sent or not. i ran the project on a real device and it worked perfectly, i tried the solutions given in other questions but non of them worked.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.tasks">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:targetApi="28"
>
even adding network_security_config.xml didn't help and didn't let to build the project with some errors.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.