Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NativeEventEmitter warnings on ReactNative 0.65 #1496

Closed
yev-yev-yev opened this issue Sep 14, 2021 · 17 comments
Closed

NativeEventEmitter warnings on ReactNative 0.65 #1496

yev-yev-yev opened this issue Sep 14, 2021 · 17 comments
Labels

Comments

@yev-yev-yev
Copy link

Version of react-native-iap

7.4.1

Version of react-native

0.65.1

Platforms you faced the error (IOS or Android or both?)

Android

Expected behavior

No warnings

Actual behavior

Multiple Logbox warnings:

 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.

Tested environment (Emulator? Real Device?)

Real Device

Steps to reproduce the behavior

  1. Upgrade to reactnative 0.65.x
  2. Run yarn android to start app on android device
@yev-yev-yev
Copy link
Author

To fix, add this to RNIapModule.java

  @ReactMethod
  public void addListener(String eventName) {
    // Keep: Required for RN built in Event Emitter Calls.
  }

  @ReactMethod
  public void removeListeners(double count) {
    // Keep: Required for RN built in Event Emitter Calls.
  }

@mayconline
Copy link

same problem =/

@SergiOnGit
Copy link
Contributor

Same here

@andkom
Copy link

andkom commented Sep 24, 2021

same in 7.5.0

@sbin1211
Copy link
Contributor

sbin1211 commented Oct 4, 2021

@hyochan , it happens since RN0.65, i created one pull request for it, pls have a review. thanks.
#1524

@andresesfm
Copy link
Contributor

This is passing CI and ready to merge: #1544

@fernandoVicentei
Copy link

Para solucionarlo, agregue esto a RNIapModule.java

  @ReactMethod
  public void addListener(String eventName) {
    // Keep: Required for RN built in Event Emitter Calls.
  }

  @ReactMethod
  public void removeListeners(double count) {
    // Keep: Required for RN built in Event Emitter Calls.
  }

En que lugar se tiene que agregar esas lineas de codigo estimado?

@LuisNetSpot
Copy link

Im getting this error on iOS with RN 0.66.3

Is there any way to solve it?

Thanks

@mifi
Copy link
Contributor

mifi commented Nov 21, 2021

can confirm this is fixed in 7.5.1

@mifi mifi closed this as completed Nov 21, 2021
@victoriaSh
Copy link

Got the same warnings with react-native@0.66.4 and react-native-iap@8.0.0-rc.4
Added this code to RNIapModule.kt and warnings disappeared.
I'm not good at Kotlin. Correct me If something is wrong, please.

    @ReactMethod
    fun addListener(type: String?) {
        // Keep: Required for RN built in Event Emitter Calls.
    }

    @ReactMethod
    fun removeListeners(type: String?) {
        // Keep: Required for RN built in Event Emitter Calls.
    }

@junedomingo
Copy link

#1496 (comment)

Can confirm this. I'm on rn@66.4 and riap@8.0.1

@mifi
Copy link
Contributor

mifi commented Feb 1, 2022

I think this is because the addListener and removeListener functions were removed from v7 to v8.

See this commit that fixed v7: https://github.com/dooboolab/react-native-iap/pull/1544/files

v8 (master) does not have this code anymore:
https://github.com/dooboolab/react-native-iap/blob/main/android/src/play/java/com/dooboolab/RNIap/RNIapModule.kt

So somehow they got lost in translation upon rewriting to kotlin. Should be pretty easy to re-add though! I'll reopen this

@mifi mifi reopened this Feb 1, 2022
@ralppppy
Copy link

Any update on this?

@mifi
Copy link
Contributor

mifi commented Feb 10, 2022

I don't speak kotlin but PR is welcome!

@sajorahasan
Copy link

sajorahasan commented Feb 11, 2022

As suggested by @victoriaSh adding below code in node_modules/react-native-iap/android/src/play/java/com/dooboolab/RNIap/RNIapModule.kt file fix the warning.

` @ReactMethod
fun addListener(type: String?) {
// Keep: Required for RN built in Event Emitter Calls.
}

@ReactMethod
fun removeListeners(type: Double?) {
    // Keep: Required for RN built in Event Emitter Calls.
}`

@stale
Copy link

stale bot commented May 14, 2022

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale label May 14, 2022
@mifi
Copy link
Contributor

mifi commented May 21, 2022

I believe this is fixed.

@mifi mifi closed this as completed May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests