How would I access Network Information like IP address in Expo?

I tried using the react-native-network-info library to access the IP address. But I get the following error with expo.

undefined is not an object. evaluating RNNetworkInfo

Is there another option to getting the IP address in an expo development/published app?

2 Likes

Hi-

Looking at that module, it has some native code that needs to be included for it to work so you’d have to eject to be able to make it work with Expo.

Off the top of my head, I don’t know of an alternative way to get the IP address info you’re looking for without adding native code unfortunately.

You can add and vote on requests for new features in Expo at https://expo.canny.io/

Charlie

Hi , sorry for the late reply. I ended up sending an http request to an IP API

Hey @furball514. Do you mind to share what IP API are you using? Is this working properly?

Thanks in advance