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
From RN 0.60 and forward, this library no longer works, since NetInfo has been entirely removed. The import will result in undefined, causing the error:
undefined is not an object (evaluating '_reactNative.NetInfo.addEventListener')
I know of no workaround, beyond patching or forking this library. Library seems unmaintained.
Found a workaround. Add the following to /index.js
(or whatever you defined in package.json as "main": "index.js"):
import ReactNative from 'react-native';
import NetInfo from '@react-native-community/netinfo';
// Monkey-patch unmaintained react-native-device-log to work with RN 0.60
// where NetInfo was removed entirely
// https://github.com/olofd/react-native-device-log/issues/23#issuecomment-513654702
ReactNative.NetInfo = NetInfo;
Update: This may not work for everyone. I found it worked on Android but did not work on iOS.
deleted
The text was updated successfully, but these errors were encountered: