expo-network returns undefined is not an object

  1. SDK Version: 34.0.3
  2. Platforms(Android/iOS/web/all): android

Can anyone give me some advice, please?

Hi in resume I´m want to get device ipAddress through expo-network getIpAddressAsyc function so I have a main class which renders a button and press event I´m calling an arrow function that looks like this:

findIp = () =>{
console.log(‘findIp’);
Network.getIpAddressAsync().then(v => {
console.log(v);
});

my import is like this:

import * as Network from ‘expo-network’;

So no matter what, I always get the same Error:

[Unhandled promise rejection: TypeError: undefined is not an object (evaluating ‘_ExpoNetwork.default.getNetworkStateAsync’)]

  • node_modules/expo-network/build/Network.js:6:21 in getNetworkStateAsync$

  • node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch

  • node_modules/regenerator-runtime/runtime.js:271:30 in invoke

  • node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch

  • node_modules/regenerator-runtime/runtime.js:135:28 in invoke

  • node_modules/regenerator-runtime/runtime.js:170:17 in

  • node_modules/promise/setimmediate/core.js:45:7 in tryCallTwo

  • node_modules/promise/setimmediate/core.js:200:23 in doResolve

  • node_modules/promise/setimmediate/core.js:66:12 in Promise

  • node_modules/regenerator-runtime/runtime.js:169:27 in callInvokeWithMethodAndArg

  • node_modules/regenerator-runtime/runtime.js:192:38 in enqueue

  • node_modules/regenerator-runtime/runtime.js:216:8 in async

  • node_modules/expo-network/build/Network.js:5:7 in getNetworkStateAsync

  • screens/Main.js:27:4 in findIp

  • screens/Main.js:300:4 in _callee7$

  • node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch

  • node_modules/regenerator-runtime/runtime.js:271:30 in invoke

  • node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch

  • node_modules/regenerator-runtime/runtime.js:135:28 in invoke

  • node_modules/regenerator-runtime/runtime.js:170:17 in

  • node_modules/promise/setimmediate/core.js:45:7 in tryCallTwo

  • node_modules/promise/setimmediate/core.js:200:23 in doResolve

  • node_modules/promise/setimmediate/core.js:66:12 in Promise

  • node_modules/regenerator-runtime/runtime.js:169:27 in callInvokeWithMethodAndArg

  • node_modules/regenerator-runtime/runtime.js:192:38 in enqueue

  • node_modules/regenerator-runtime/runtime.js:216:8 in async

  • screens/Main.js:299:17 in _callee7

  • screens/Main.js:374:69 in onPress

  • node_modules/react-native/Libraries/Components/Touchable/TouchableOpacity.js:235:45 in touchableHandlePress

  • node_modules/react-native/Libraries/Components/Touchable/Touchable.js:878:34 in _performSideEffectsForTransition

  • … 21 more stack frames from framework internals

this is my package.json

{
“main”: “node_modules/expo/AppEntry.js”,
“scripts”: {
“start”: “expo start”,
“android”: “expo start --android”,
“ios”: “expo start --ios”,
“eject”: “expo eject”
},
“dependencies”: {
@unimodules/core”: “^5.0.0”,
“base64-js”: “^1.3.0”,
“expo”: “^34.0.3”,
“expo-camera”: “~6.0.0”,
“expo-constants”: “~6.0.0”,
“expo-image-manipulator”: “~6.0.0”,
“expo-intent-launcher”: “^6.0.0”,
“expo-location”: “~6.0.0”,
“expo-media-library”: “~6.0.0”,
“expo-network”: “^2.0.0”,
“expo-permissions”: “~6.0.0”,
“moment”: “^2.24.0”,
“react”: “16.8.3”,
“react-native”: “https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz”,
“react-native-calendars”: “^1.204.0”,
“react-native-divider”: “^1.0.3”,
“react-native-elements”: “^1.0.0”,
“react-native-gesture-handler”: “~1.3.0”,
“react-native-image-slider-show”: “^1.0.3”,
“react-native-maps”: “^0.26.1”,
“react-native-modal-datetime-picker”: “^6.0.0”,
“react-native-modal-filter-picker”: “^1.3.4”,
“react-native-reanimated”: “~1.1.0”,
“react-native-smart-corner-label”: “^1.1.2”,
“react-native-tab-view”: “^2.10.0”,
“react-native-unimodules”: “^0.7.0”,
“react-native-vector-icons”: “^6.6.0”,
“react-native-webview”: “~5.12.0”,
“react-navigation”: “^3.11.1”
},
“devDependencies”: {
“babel-preset-expo”: “^5.0.0”
},
“private”: true
}