react-native-pip-android icon indicating copy to clipboard operation
react-native-pip-android copied to clipboard

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

Open PaulWozny opened this issue 2 years ago • 1 comments

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 installed the package inside expo project. Following errors are seen:

 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.

I looked it up on stack (its a common problem for other packages) and found out the solution https://stackoverflow.com/a/74604935

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-pip-android/src/PipHandler.ts b/node_modules/react-native-pip-android/src/PipHandler.ts
index 660158a..eefc1ca 100644
--- a/node_modules/react-native-pip-android/src/PipHandler.ts
+++ b/node_modules/react-native-pip-android/src/PipHandler.ts
@@ -6,7 +6,7 @@ class PipHandler {
   constructor() {
     this.EventEmitter =
       Platform.OS === 'android'
-        ? new NativeEventEmitter(NativeModules.PipAndroid)
+        ? new NativeEventEmitter()
         : null;
   }
 

This issue body was partially generated by patch-package.

PaulWozny avatar Dec 22 '22 11:12 PaulWozny