Leanplum / Leanplum-ReactNative-SDK

Leanplum's integrated solution delivers meaningful engagement across messaging and the in-app experience.
https://www.leanplum.com/
Apache License 2.0
7 stars 8 forks source link

'new NativeEventEmitter()' was called with a non-null argument without the required 'addListener/removeListeners' method. #60

Closed Bej-Technologies closed 2 years ago

Bej-Technologies commented 2 years ago

I am getting the following warnings when running my app on Android with "@leanplum/react-native-sdk": "^1.2.1" on "react-native": "0.65.0".

'new NativeEventEmitter()' was called with a non-null argument without the required 'addListener' method.
'new NativeEventEmitter()' was called with a non-null argument without the required 'removeListeners' method.

It seems to be solved by adding the following to LeanplumInboxModule.java and LeanplumModule.java:

@ReactMethod
public void addListener(String eventName) {
    // Needed to remove warning
}

@ReactMethod
public void removeListeners(Integer count) {
    // Needed to remove warning
}

It seems to be related to this change: https://github.com/facebook/react-native/commit/114be1d2170bae2d29da749c07b45acf931e51e2

hborisoff commented 2 years ago

@Bej-Technologies Thank you for noting that! I tried it and it solves the warning. We'll include it in the next release.

nzagorchev commented 2 years ago

Fixed in 1.3.0