JuanSeBestia / react-native-wifi-reborn

A react-native implementation for viewing and connecting to Wifi networks on Android and iOS devices.
ISC License
365 stars 125 forks source link

Expo: null is not an object (evaluating '_reactNativeWifiReborn.default.getCurrentWifiSSID') #52

Closed prokis65 closed 4 years ago

prokis65 commented 4 years ago

Hi, following instructions, I tried to test this lib in my expo project:

import WifiManager from "react-native-wifi-reborn";

... WifiManager.getCurrentWifiSSID().then( ssid => { console.log("Your current connected wifi SSID is " + ssid); }, () => { console.log("Cannot get current SSID!"); } ); ...

but have the following error:

null is not an object (evaluating '_reactNativeWifiReborn.default.getCurrentWifiSSID')

What to do?

Regards

Rapsssito commented 4 years ago

@prokis65, thanks for the feedback! Is your issue related to #35?

prokis65 commented 4 years ago

Hi, it looks like I can't import WifiManager correctlly. Any use of WifiManager in my code ends in error (null is not an object (evaluating '_reactNativeWifiReborn.default.getCurrentWifiSSID'))

Rapsssito commented 4 years ago

@prokis65, which steps did you follow for the installation? Could you provide your RN version, OS, react-native-wifi-reborn version, etc.?

prokis65 commented 4 years ago

bellow find my package.json, please. I is not a fresh project but was created by expo init. I added react-native-wifi-reborn by npm install react-native-wifi-reborn --save, and tried also react-native link react-native-wifi-reborn.

{ "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", "eject": "expo eject" }, "dependencies": { "@aws-amplify/api": "^2.1.5", "@aws-amplify/auth": "^2.1.5", "@aws-amplify/pubsub": "^2.1.6", "@react-native-community/masked-view": "0.1.5", "@react-native-community/netinfo": "4.6.0", "@react-native-community/slider": "^2.0.8", "buffer": "^5.5.0", "expo": "~36.0.2", "expo-permissions": "~8.0.0", "hashids": "^2.2.1", "memoize-one": "^5.1.1", "native-base": "^2.13.8", "react": "~16.9.0", "react-dom": "~16.9.0", "react-native": " https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz", "react-native-gesture-handler": "~1.5.0", "react-native-hide-show-password-input": "^1.1.0", "react-native-reanimated": "~1.4.0", "react-native-render-html": "^4.2.0", "react-native-safe-area-context": "^0.6.0", "react-native-screens": "2.0.0-alpha.12", "react-native-svg": "9.13.3", "react-native-web": "~0.11.7", "react-native-webview": "7.4.3", "react-native-wifi-reborn": "^3.0.0", "react-navigation": "^4.1.0", "react-navigation-drawer": "^2.3.3", "react-navigation-stack": "^2.0.16" }, "devDependencies": { "@babel/core": "^7.0.0", "@types/react": "~16.9.0", "@types/react-native": "~0.60.23", "babel-preset-expo": "~8.0.0", "typescript": "~3.6.3" }, "private": true }

czw., 19 mar 2020 o 11:22 Rodrigo Martin notifications@github.com napisał(a):

@prokis65 https://github.com/prokis65, which steps did you follow for the installation? Could you provide your RN version, OS, react-native-wifi-reborn version, etc.?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JuanSeBestia/react-native-wifi-reborn/issues/52#issuecomment-601101358, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXRBEARYZ6MW7ZVDFJK2PLRIHW5LANCNFSM4LNVRU3Q .

Rapsssito commented 4 years ago

@prokis65, I don't know about Expo, but I think you may have to eject the project before installing react-native-wifi-reborn.

Rapsssito commented 4 years ago

@prokis65, could you try two things?

olegz-codefresh commented 4 years ago

I have same problem. Anyone knows how to solve it? Few things: 1) ACCESS_FINE_LOCATION permissions is granted 1) reinstalling node_modules didn't help 2) similar error with others wifi/networks npm modules

eliaslecomte commented 4 years ago

Emulator or device? Android or iOS?

kilisoria commented 4 years ago

Hi Guys, I'm having same error using iOS emulator. iOS 13. Anyone has some idea?

eliaslecomte commented 4 years ago

Hi Guys, I'm having same error using iOS emulator. iOS 13. Anyone has some idea?

This doesn't work in an emulator?

rogerespinoza commented 4 years ago

No, it works for me in android studio emulator, since I install the dependency.

rogerespinoza commented 4 years ago

This is the error message I get when I try to install. Captura de Pantalla 2020-07-20 a la(s) 00 31 07

wathui99 commented 4 years ago

Hi, this error will be solved if you guys eject to expokit https://docs.expo.io/expokit/eject/

rogerespinoza commented 4 years ago

Hello, in the documentation you specify that Expokit is deprecated, but I don't know where the problem originates, since I tried to add the dependency, in a project created with $ npx react-native init exapleProyect giving me the same error. in reactNative @ 0.63.1 version

Rapsssito commented 4 years ago

@prokis65, could you try two things?

* First try with `cd android` and run `./gradlew clean`.

* If it doesn't work try to reinstall your `node_modules`.

If you are using iOS, make sure to clean the build cache data. Also, beware that React Native on iOS do not work well with WiFi changes (more info here).

rogerespinoza commented 4 years ago

Thank you, if it worked for me clearing the gradlew cache.