MindscapeHQ / raygun4reactnative

ReactNative crash reporting SDK for Raygun
MIT License
3 stars 3 forks source link

RaygunClient.init causes the 'new NativeEventEmitter()` warning #75

Closed javapyscript closed 10 months ago

javapyscript commented 10 months ago

Hello. I am trying to add raygun4reactnative to an existing expo prebuild project, and although it works fine, I get the following warnings when the app starts:

[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.

The warning goes away if I remove the raygun import and init.

Is this expected or am I missing something from the documentation? Thank you.

javapyscript commented 10 months ago

Ok. Just to rule out expo or current project settings, I creating a new react native CLI app and followed the docs for raygun installation. I am getting the same warnings on this new app too.

darcythomas commented 10 months ago

Hi @javapyscript.

I am one of the engineers who work on this Raygun Provider. Thanks for bringing this to our attention.

Would mind sharing your minimal implementation with me?

I'll will give it a spin locally, and see what we can do to fix this issue for you :)

javapyscript commented 10 months ago

Thanks so much for having a look @darcythomas. I have the react native starter app with raygun installed here: https://github.com/javapyscript/raygunDemo/tree/master/AwesomeProject

This is what I see on the console when the app runs:

`BUNDLE ./index.js

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. LOG Running "AwesomeProject" with {"rootTag":11}`

redJ4y commented 10 months ago

Hello @javapyscript!

The warnings you're encountering appear to be related to the Android bridge. In the current version, the native module used for Android (RaygunNativeBridgeModule) does not explicitly define the addListener and removeListeners methods. These methods are expected by React Native's NativeEventEmitter class, even when they're not strictly necessary for the module's functionality.

This oversight leads to the warnings you're seeing. It's important to note that these warnings do not affect the functionality of Raygun4ReactNative in your project.

To address this, I can add dummy implementations of addListener and removeListeners in the RaygunNativeBridgeModule in the next version. These implementations will be placeholders to satisfy the interface requirements of NativeEventEmitter and will prevent such warnings from appearing, without affecting the actual functionality of the module.

Thank you for bringing this up, and thank you for the sample project with your environment configurations! 😄

redJ4y commented 10 months ago

This is has been addressed in version 1.3.0-beta. Note that version 1.3.0 will be fully released after the usage of Raygun4Apple version 2.0.0 has been thoroughly tested (which is unrelated to this warning).