Closed ferdylimmm9 closed 1 year ago
:warning: | Newer Version of React Native is Available! |
---|---|
:information_source: | You are on a supported minor version, but it looks like there's a newer patch available - 0.71.11. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |
i solved the solution with this comment https://stackoverflow.com/a/60116643/15010934
import com.facebook.react.modules.network.OkHttpClientProvider;
into your MainApplication.java@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
OkHttpClientProvider.setOkHttpClientFactory(new CustomClientFactory()); //add this line.
}
Description
React.useEffect(() => { async function exec() { try { //can fetch const response = await fetch('https://fakestoreapi.com/products'); const response = await fetch('https://forum-api.dicoding.dev/v1/users');
}, []);
React Native Version
0.71.8
Output of
npx react-native info
System: OS: macOS 13.4 CPU: (8) arm64 Apple M1 Pro Memory: 328.63 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.12.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 9.6.6 - /opt/homebrew/bin/npm Watchman: 2023.06.12.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.12.1 - /Users/ferdylim/.gem/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: API Levels: 26, 28, 29, 30, 31, 33, 33 Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0, 33.0.0, 33.0.2 System Images: android-24 | Google APIs ARM 64 v8a, android-26 | Google APIs ARM 64 v8a, android-29 | Google APIs ARM 64 v8a, android-31 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9619390 Xcode: 14.3/14E222b - /usr/bin/xcodebuild Languages: Java: 11.0.19 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.8 => 0.71.8 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
when apps run at android < 10, fetch will show error typeerror
Snack, code example, screenshot, or link to a repository
build.gradle
app/build.gradle
package.json