pushy / pushy-react-native

The official Pushy SDK for React Native apps.
Apache License 2.0
16 stars 20 forks source link

'new NativeEventEmitter()' was called with a non-null argument #77

Closed kris1803 closed 2 years ago

kris1803 commented 2 years ago

When importing library to project, doing correctly all steps and building app, two warnings appear :

image

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 is logged in console and appears as warning on device screen. I'm using expo, bare workflow. I found a solution: adding to Pushy.js two lines of code :

Pushy.addListener = () => {}
Pushy.removeListeners = () => {}

Then no more warnings. This is an issue from 2021, of how react native changed.

pushy commented 2 years ago

Hi @kris1803, Thanks for your report and for the suggested workaround.

Are you able to get our SDK working properly in Expo? Last we checked, HeadlessJS tasks were broken in Expo. Please confirm background notification delivery works on Android with Expo and we will resolve these warnings.

kris1803 commented 2 years ago

Yes, headless tasks work (or if you talk about pushy register and listen more precisely), so app can wake up when it was killed to receive notification. So it works properly, but meanwhile I didn't test subscriptions to notifications. I must precise that I use Expokit, it is a hybrid between expo and bare react native.

pushy commented 2 years ago

Hi @kris1803, Thanks for confirming.

This warning has now been resolved in https://github.com/pushy/pushy-react-native/commit/a1a1fe0ca8e9ca56755b651884a2f461f9a08e0f and published to npm in version 1.0.23. 🎉