You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Same issue exists. The API call is working in a real device, but not in the emulator.
Now, my concern is, Should I worry that it doesn't work on emulator? It will be good if someone can answer this question, so that I can work with the real device until this issue is sorted out.
facebook
locked as resolved and limited conversation to collaborators
Apr 30, 2022
Description
React Native version:
System:
OS: macOS 11.3
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 731.05 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.15.1 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.10.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.7199119
Xcode: 12.4/12D4e - /usr/bin/xcodebuild
Languages:
Java: 11.0.10 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.0 => 0.64.0
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps To Reproduce
set up project
npx react-native init AwesomeTSProject --template react-native-template-typescript
App.tsx
async function helloServer() {
try {
const response = await fetch("https://www.*****.com/greeter/hello", {
headers: new Headers({ "Content-Type": "application/json" }),
});
const json = await response.json();
console.log(json);
} catch (error) {
console.log(error);
}
}
export default function App() {
useEffect(() => {
helloServer();
}, []);
return (
Open up App.tsx to start working on your app!
);
}
Expected Results
Server response should be logged.
The text was updated successfully, but these errors were encountered: