Skip to content

[WIP] Add TurboModule specs and codegen components to prepare RN new-arch migration#449

Open
kieran-osgood-shopify wants to merge 9 commits intomainfrom
cx-rn-new-arch-plan
Open

[WIP] Add TurboModule specs and codegen components to prepare RN new-arch migration#449
kieran-osgood-shopify wants to merge 9 commits intomainfrom
cx-rn-new-arch-plan

Conversation

@kieran-osgood-shopify
Copy link
Copy Markdown
Contributor

What changes are you making?


PR Checklist

Important

Releasing a new version of the kit?


Tip

See the Contributing documentation for instructions on how to publish a new version of the library.

Copy link
Copy Markdown
Contributor Author

kieran-osgood-shopify commented Mar 25, 2026

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 25, 2026

Coverage Report

Lines Statements Branches Functions
Coverage: 99%
99.52% (210/211) 97.5% (117/120) 100% (61/61)

@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from main to graphite-base/449 March 26, 2026 10:30
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from graphite-base/449 to kieran-osgood/03-25-chorebumpdev.ymltoios26.2 March 26, 2026 10:30
Base automatically changed from kieran-osgood/03-25-chorebumpdev.ymltoios26.2 to main March 26, 2026 10:41
…igration

Prepare codebase for React Native new-architecture (TurboModules/codegen) by adding JS specs, codegen native components, and test mocks.

What changed and why:
- Added a TurboModule spec (NativeShopifyCheckoutSheetKit) and a codegen native component spec (RCTAcceleratedCheckoutButtonsNativeComponent) to declare the native API surface and typed component props. This moves JS to consume the new-arch API surface via TurboModuleRegistry and codegenNativeComponent instead of using NativeModules/requireNativeComponent directly.
- Updated AcceleratedCheckoutButtons to import codegenNativeComponent and use the generated native component type instead of requireNativeComponent.
- Added codegenConfig to the package.json to configure codegen generation for this module.
- Added Jest mocks for codegenNativeComponent and extended the react-native manual mock to provide TurboModuleRegistry.getEnforcing, getConstants, and event listener helpers so unit tests run against the new-arch surface.
- Added a moduleNameMapper entry to jest.config.js so tests resolve the codegenNativeComponent import to the new mock.
- Updated a linking test to assert TurboModuleRegistry behavior (throws when module not present) rather than the old NativeModules linking error.
- Adjusted runtime usage to read version via getConstants() and cast getConfig() return types for better typing with the spec.

Context and next steps:
- These changes are groundwork only: they enable the JS-side migration to the RN new architecture and allow tests to run against the new-arch signatures.
- Native implementations (iOS/Android) still need corresponding TurboModule and codegen native component implementations, and we must decide on compatibility strategy (clean break vs dual support). Dual support will add duplication (parallel native hooks, bridging shims) and phased rollout; a clean break requires coordinating release timelines for hosts consuming this module.
- Suggested next phases: (1) implement native TurboModule & codegen components on each platform, (2) add migration shims to continue supporting old NativeModules if dual-mode required, (3) integration testing & performance validation, (4) cutover and remove old-arch shims when safe.

This commit prepares the repository for the migration and makes future work (native bindings and compatibility strategy) easier to implement and test.
Reduce the surface area and simplify startup scripts to prepare for the React Native new-arch migration.

- Narrow CompleteEvent.orderDetails to a readonly object containing only id, email and phone (remove nested cart/lines). This reduces the amount of complex data being passed through the bridge and simplifies the typings for the accelerated checkout UI component and its native/JS contract. Note: this is a breaking API/type change for any consumers that relied on the cart payload — update callers accordingly.

- Simplify sample/package.json scripts by removing hard-coded simulator selection for ios/start. This makes the sample project scripts more portable across developer machines and CI and avoids simulator name mismatches during iteration.

These changes are intended to lower duplication and complexity while we plan the phased migration to the new RN architecture (fewer/cleaner native<->JS contracts makes a cleaner transition).
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as ready for review March 26, 2026 12:02
@kieran-osgood-shopify kieran-osgood-shopify requested a review from a team as a code owner March 26, 2026 12:03
kieran-osgood-shopify and others added 3 commits March 26, 2026 12:04
Add TypeScript spec stubs and package snapshot entries to prepare for React Native’s new architecture.

These changes introduce spec files for the native module/native component surface (with MIT license headers) and update the package snapshot so the generated commonjs/module/typescript artifacts and type declarations are tracked. This is a preparatory change to enable codegen/TurboModule and native component integration as part of the larger new-arch migration. No runtime behavior is changed here — this just lays the groundwork for the phased migration to the new RN architecture and packaging of the generated artifacts.
The macOS runner's pre-installed npm has a corrupted promise-retry
module, causing `npm install -g npm@11` to fail. Since all CI jobs
use yarn (not npm), this step is non-critical. Emit a warning
annotation and continue instead of failing the job.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ndency resolution

The Gradle foojay-resolver-convention plugin needs gson from Maven Central,
which intermittently returns 403. Adding explicit pluginManagement repositories
(gradlePluginPortal, google, mavenCentral) provides fallback mirrors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
kieran-osgood-shopify and others added 2 commits March 26, 2026 17:53
The macOS runner's pre-installed npm has a corrupted promise-retry
module, causing `npm install -g npm@11` to fail. Since all CI jobs
use yarn (not npm), this step is non-critical. Emit a warning
annotation and continue instead of failing the job.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kieran-osgood-shopify kieran-osgood-shopify changed the title Add TurboModule specs and codegen components to prepare RN new-arch migration [WIP] Add TurboModule specs and codegen components to prepare RN new-arch migration Mar 26, 2026
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

Successfully merging this pull request may close these issues.

1 participant