DEV Community

loading...

Discussion on: Getting connected status on React Native

Collapse
mutatedbread profile image
Ng Chen Hon Author

Hi,

Forgive me for this very late reply.

I am presuming you are getting the error when running it on iOS.

I had not taken into consideration that any network requests on iOS must be https or have the url placed into exception when I was writing this.

Please try with the below if you are still stuck on this.

let req = await fetch('https://www.google.com');
let hasConnection = req.status === 200;
Forem Open with the Forem app