Conversation
Summary of ChangesHello @MiguelBebensee, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical runtime error on iOS for React Native applications using Adyen's Drop-in component. The fix addresses an issue with module resolution in older React Native versions by modifying how specific Adyen components are imported, ensuring they are correctly defined when accessed. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively resolves an invariant violation on iOS by replacing a problematic barrel import with direct imports in getWrapper.ts. This is a clear and direct fix for the circular dependency issue encountered with older React Native versions. The change improves the stability of module loading. I have one suggestion to further improve code maintainability.
src/modules/base/getWrapper.ts
Outdated
| import { AdyenDropIn } from '../dropin/AdyenDropIn'; | ||
| import { AdyenApplePay } from '../applepay/AdyenApplePay'; | ||
| import { AdyenGooglePay } from '../googlepay/AdyenGooglePay'; | ||
| import { AdyenInstant } from '../instant/AdyenInstant'; |
There was a problem hiding this comment.
For improved code readability and maintainability, it's a good practice to keep import statements sorted alphabetically by path. This makes it easier to locate specific imports and can help prevent merge conflicts in the future.
| import { AdyenDropIn } from '../dropin/AdyenDropIn'; | |
| import { AdyenApplePay } from '../applepay/AdyenApplePay'; | |
| import { AdyenGooglePay } from '../googlepay/AdyenGooglePay'; | |
| import { AdyenInstant } from '../instant/AdyenInstant'; | |
| import { AdyenApplePay } from '../applepay/AdyenApplePay'; | |
| import { AdyenDropIn } from '../dropin/AdyenDropIn'; | |
| import { AdyenGooglePay } from '../googlepay/AdyenGooglePay'; | |
| import { AdyenInstant } from '../instant/AdyenInstant'; |
Issue: Invariant Violation: new NativeEventEmitter() requires a non-null argument on iOS when opening Drop-in (React Native 0.80.2)
Root cause: In v2.9.0, getWrapper.ts imports AdyenDropIn through a barrel re-export:
This resolves through modules/index.ts, which re-exports from each submodule. On React Native 0.80.2 with Metro bundler, AdyenDropIn is undefined at the time getWrapper() is called, causing new NativeEventEmitter(undefined) to throw the invariant violation on iOS.
This was not an issue in v2.8.0 because getWrapper created a new wrapper instance each call (new DropInComponentWrapper()) using a directly imported native module, rather than referencing a pre-constructed singleton through a barrel export.
Fix: Replace the barrel import with direct imports:
This is likely not reproducible on RN 0.83.1 due to Metro bundler improvements in newer React Native versions.