new NativeEventEmitter() was called with a non-null argument [needs PR! good first issue!]

See original GitHub issue

Environment

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:open
  • Created 2 years ago
  • Reactions:22
  • Comments:38 (16 by maintainers)

github_iconTop GitHub Comments

13reactions
russegcommented, May 30, 2022

@JRGunthner so do I! Looking forward to your PR.

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.

9reactions
JRGunthnercommented, Mar 15, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - new NativeEventEmitter()` was called with a non-null ...
When application loads react native throw warnings. WARN `new NativeEventEmitter()` was called with a non-null argument without the required ` ...
Read more >
`new nativeeventemitter()` was called with a non-null ...
WARN `new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method. It was working in the past on React Native...
Read more >
NativeEventEmitter warnings on ReactNative 0.65 #1496
WARN `new NativeEventEmitter()` was called with a non-null argument ... You may also label this issue as "For Discussion" or "Good first issue"...
Read more >
react-native-nested-dnd - npm package - Snyk
Latest version published 1 year ago ... No known security issues ... Violation: new NativeEventEmitter() requires a non-null argument. ).
Read more >
Good First Issue: Issues for your first open-source contribution
Making your first open-source contribution is easier than you think. Good First Issue is a curated list of issues from popular open-source projects...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found