Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

fix(android): new NativeEventEmitter() warning on RN 65+ #116

@Titozzz

Description

@Titozzz

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

I initially though this was the reason this module wasn't "compatible" with RN 0.65+ but you released 6.0.0 and it's not fixed.
When used on android with react native >= 0.65, there is a warning.
This patch removes the warning. See theses PR to other libraries:

Here is the diff that solved my problem:

diff --git a/node_modules/launchdarkly-react-native-client-sdk/android/src/main/java/com/launchdarkly/reactnative/LaunchdarklyReactNativeClientModule.java b/node_modules/launchdarkly-react-native-client-sdk/android/src/main/java/com/launchdarkly/reactnative/LaunchdarklyReactNativeClientModule.java
index a3cdb1b..23a94d4 100644
--- a/node_modules/launchdarkly-react-native-client-sdk/android/src/main/java/com/launchdarkly/reactnative/LaunchdarklyReactNativeClientModule.java
+++ b/node_modules/launchdarkly-react-native-client-sdk/android/src/main/java/com/launchdarkly/reactnative/LaunchdarklyReactNativeClientModule.java
@@ -187,6 +187,16 @@ public class LaunchdarklyReactNativeClientModule extends ReactContextBaseJavaMod
         return constants;
     }
 
+    @ReactMethod
+    public void addListener(String eventName) {
+        // Keep: Required for RN built in Event Emitter Calls.
+    }
+
+    @ReactMethod
+    public void removeListeners(Integer count) {
+        // Keep: Required for RN built in Event Emitter Calls.
+    }
+
     @ReactMethod
     public void configure(ReadableMap config, ReadableMap user, final Promise promise) {
         internalConfigure(config, user, null, promise);

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions