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

"new NativeEventEmitter() was called with non-null argument without the required "addListener" method" #1032

Closed
HugoCamposLopez opened this issue Jul 5, 2022 · 14 comments

Comments

@HugoCamposLopez
Copy link

HugoCamposLopez commented Jul 5, 2022

Describe the bug
I am using React Native and I installed the stripe-react-native SDK.
I set it up and it is working. I followed these instructions https://stripe.com/docs/payments/accept-a-payment?platform=react-native.
But every time I start my app it keeps telling me "new NativeEventEmitter() was called with non-null argument without the required "addListener" method"

I don't know which Listener, as soon i comment //import { StripeProvider, useStripe } from "@stripe/stripe-react-native"; the warning disappear how can i fix this warning?

IM NOT USING APPLE PAY,
I'm using presentPaymentSheet and initPaymentSheet

To Reproduce
Steps to reproduce the behavior:
I followed all instructions and as soon I open the APP I get that message.

Expected behavior
Not receive a warn.

Screenshots
image
image

Smartphone (please complete the following information):

  • iPhone 11
  • OS: 15.5

Additional context
"@types/react-native": "~0.66.13",
"@stripe/stripe-react-native": "^0.12.0",
"expo": "~45.0.0",
expo --version
5.4.12

@charliecruzan-stripe
Copy link
Collaborator

this is due to the version of stripe react native pinned in sdk 45- https://github.com/expo/expo/blob/sdk-45/packages/expo/bundledNativeModules.json#L11

you cannot use v 0.12.0 while on SDK 45. But this is fixed in a more recent version.

closing since this was fixed in 7cfcdc0

@HugoCamposLopez
Copy link
Author

I downgrade to
"@stripe/stripe-react-native": "0.6.1"

iOS: Warning is gone.
Android: Still showing it.

@charliecruzan-stripe
Copy link
Collaborator

Ah we might be missing some blank override methods, I'll take care of that. In the meantime, you can silence this warning if you don't want to see it

@HugoCamposLopez
Copy link
Author

sure! Thank you

@jordzawada
Copy link

jordzawada commented Aug 17, 2022

I am getting this issue on "@stripe/stripe-react-native": "0.17.0", with SDK 45. What stripe version is recommended with SDK 45 now?

@charliecruzan-stripe
Copy link
Collaborator

you can use expo install to install the appropriate version of stripe :)

@martimarkov
Copy link

@charliecruzan-stripe has this been fixed for android? I'm 0.20.0 and still seeing this issue:

Screenshot 2022-11-14 at 03 23 38

@charliecruzan-stripe
Copy link
Collaborator

Are you using expo?

@justinadkins
Copy link

Having the same problem on 0.21.0. I added this to StripeSdkModule.kt and it resolved the issue:

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

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

@textual
Copy link

textual commented Feb 9, 2023

Having issue on Android, not IOS using latest expo and stripe builds afaik
"@stripe/stripe-react-native": "0.19.0",
"expo": "~47.0.12",
"react": "18.1.0",
"react-native": "0.70.5"

@justinadkins
Copy link

@textual this was addressed in 0.22.0+ IIRC

@textual
Copy link

textual commented Feb 9, 2023

I'm using expo, so when I upgrade to the latest stripe, I get this error:

Some dependencies are incompatible with the installed expo version:
@stripe/stripe-react-native@0.23.3 - expected version: 0.19.0
Your project may not work correctly until you install the correct versions of the packages.
Install individual packages by running npx expo install @stripe/stripe-react-native@0.19.0

not sure which is worse, expo incompatibility or andrioid not liking nativeeventemitter

@charliecruzan-stripe
Copy link
Collaborator

You can ignore that particularly warning with this: https://stackoverflow.com/questions/69538962/new-nativeeventemitter-was-called-with-a-non-null-argument-without-the-requir, which I would recommend instead of using a version that is not compatible with your Expo version

@Danielz2003
Copy link

Are you using expo?

i'm using expo. same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants