new NativeEventEmitter() was called with a non-null argument [needs PR! good first issue!]
See original GitHub issueEnvironment
System: OS: macOS 11.5.2 CPU: (8) arm64 Apple M1 Memory: 152.89 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 15.14.0 - ~/.nvm/versions/node/v15.14.0/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.7.6 - ~/.nvm/versions/node/v15.14.0/bin/npm Watchman: Not Found Managers: CocoaPods: 1.10.1 - /Users/lyubomyr/.rbenv/shims/pod SDKs: iOS SDK: Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4 Android SDK: API Levels: 29, 30 Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3 System Images: android-30 | Google APIs ARM 64 v8a, android-S | Google APIs ARM 64 v8a, android-S | Google Play ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7621141 Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild Languages: Java: 1.8.0_282 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.65.0 => 0.65.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Platforms
Issue appears only on Android Platform
Versions
- Android: 11
- iOS:
- react-native-netinfo: 6.0.0
- react-native: 0.65.0
- react: 0.17.2
Description
With newest react-native version 0.65.0 which was released few days ago, on android platform when run app i can see warnings:
WARN new NativeEventEmitter()
was called with a non-null argument without the required addListener
method.
WARN new NativeEventEmitter()
was called with a non-null argument without the required removeListeners
method.
These warnings not appeared on react-native 0.64.2 and older versions, also not appear on IOS platform
Reproducible Demo
Just create new template of react-native project and add import NetInfo from “@react-native-community/netinfo”;
const unsubscribe = NetInfo.addEventListener(state => { console.log(“Connection type”, state.type); console.log(“Is connected?”, state.isConnected); });
Issue Analytics
- State:
- Created 2 years ago
- Reactions:22
- Comments:38 (16 by maintainers)
Top GitHub Comments
Why are you asking him, did he introduced the problem???
@mikehardy I noticed you seem to like to tell people to do PR when they have a problem. Well, how about not putting in the bug in the first place?
I know what you are tying to do with this “looking forward to your PR” nonsense of yours. Not really passive aggresive in my book, but pretty dumb nonetheless. And I will call you out on it whenever I see a post of yours like this.
Putting this, at least removed the warnings but it’s still not the best solution:
import { LogBox } from ‘react-native’; LogBox.ignoreLogs([‘new NativeEventEmitter’]); // Ignore log notification by message LogBox.ignoreAllLogs(); //Ignore all log notifications