fix: use platform-specific stubs for Apple Pay and Google Pay native components#36
Open
fix: use platform-specific stubs for Apple Pay and Google Pay native components#36
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Metro bundler crashes by preventing codegenNativeComponent from running at module load time for platform-exclusive (Apple Pay / Google Pay) Fabric components.
Changes:
- Replaced the cross-platform native component modules with lightweight stubs exporting a plain
View. - Added platform-specific implementations (
.ios.ts/.android.ts) that contain the realcodegenNativeComponentcalls.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/native/NativeGooglePayButton.ts | Converts the default module into an iOS/non-Android stub to avoid Android-only codegen at bundle time. |
| src/native/NativeGooglePayButton.android.ts | Adds Android-specific codegenNativeComponent implementation for the Google Pay button. |
| src/native/NativeApplePayButton.ts | Converts the default module into an Android/non-iOS stub to avoid iOS-only codegen at bundle time. |
| src/native/NativeApplePayButton.ios.ts | Adds iOS-specific codegenNativeComponent implementation for the Apple Pay button. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
abbd379 to
2d92299
Compare
2d92299 to
a9d31ef
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
RhysAtBolt
approved these changes
Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes a Metro bundler crash caused by
codegenNativeComponentbeing called at module load time for platform-exclusive native components. On Android,codegenNativeComponent('BoltApplePayButton')runs during bundling even though Apple Pay is iOS-only, and Metro cannot find the Fabric component config, resulting in a hard bundler failure (the inverse applies on iOS for Google Pay).The fix introduces platform-specific stub files:
ApplePay.android.tsxreturnsnullon Android, andGoogleWallet.ios.tsxreturnsnullon iOS. Metro automatically resolves the correct file per platform, so the realcodegenNativeComponentcalls only execute on their native platform. The stubs are never rendered in practice because the parent components already guard behindPlatform.OSchecks. Also bumpsSDK_VERSIONto0.5.2.Testing
Could not find component config for native componentno longer occurs.Platform.OS === 'android'inGoogleWallet).SDK_VERSIONreads0.5.2in telemetry output.Security Review
Important
A security review is required for every PR in this repository to comply with PCI requirements.
Security Impact Summary
No security-sensitive changes. This PR only modifies how native UI components are resolved per platform at bundle time. It does not affect payment logic, authentication, data handling, or any external integrations.