stripe-react-native: 🐛 Build broken due to duplicate registered views for GooglePayButton and ApplePayButton

Describe the bug

We’re trying out v0.22.0 to try the new createPlatformPayPaymentMethod flow. With the new version our metro builds fail with the following:

[Sat Dec 03 2022 14:23:46.213]  ERROR    Invariant Violation: Tried to register two views with the same name GooglePayButton

This seems to be due to the fact that @stripe/stripe-react-native is now internally calling

requireNativeComponent<any>('GooglePayButton')

in two different places, once in src/components/GooglePayButton.tsx and once in src/components/PlatformPayButton.tsx. If we comment out one of the requires (in our case src/components/GooglePayButton.tsx), the build works again*

* after resolving the GooglePayButton issue we saw the same thing for ApplePayButton, resolved in the same way.

To Reproduce

Run yarn start for your app after importing createPlatformPayPaymentMethod, then start up an ios simulator to start the metro dev-server compilation process.

Expected behavior

We can build our app with the new @stripe/stripe-react-native version.

Additional context

We’re on react-native@63, which may be a factor if you’re unable to reproduce on your own machine (further bumping to latest react-native for us was blocked by tipsi-stripe issues, which is why we’re trying to migrate to @stripe/stripe-react-native).

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

Fixed in Fixed in v0.22.1 ✅