Skip to content

Remove New Arch interop checks - New Arch only#456

Open
kieran-osgood-shopify wants to merge 15 commits intomainfrom
kieran-osgood/03-30-featreplaceinteropwithnewarchcode
Open

Remove New Arch interop checks - New Arch only#456
kieran-osgood-shopify wants to merge 15 commits intomainfrom
kieran-osgood/03-30-featreplaceinteropwithnewarchcode

Conversation

@kieran-osgood-shopify
Copy link
Copy Markdown
Contributor

@kieran-osgood-shopify kieran-osgood-shopify commented Mar 30, 2026

What changes are you making?

Following on from the introduction of turbo specs in #449 this PR removes the existing fabric conditionals leaving only the new architecture enabled going forwards


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 30, 2026

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 30, 2026

Coverage Report

Lines Statements Branches Functions
Coverage: 99%
99.53% (213/214) 95.96% (119/124) 100% (64/64)

@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/03-30-featreplaceinteropwithnewarchcode branch from 14eb240 to b78d8d1 Compare April 14, 2026 11:58
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/03-30-featreplaceinteropwithnewarchcode branch from b78d8d1 to ead781e Compare April 16, 2026 16:21
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as ready for review April 16, 2026 17:06
@kieran-osgood-shopify kieran-osgood-shopify requested a review from a team as a code owner April 16, 2026 17:06
@kieran-osgood-shopify kieran-osgood-shopify changed the title feat: replace interop with new arch code Remove New Arch interop checks - New Arch only Apr 17, 2026
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/03-30-featreplaceinteropwithnewarchcode branch 5 times, most recently from 07d29f6 to ba34eac Compare April 17, 2026 09:16
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/03-30-featreplaceinteropwithnewarchcode branch 2 times, most recently from 9c8a074 to 4be033f Compare April 17, 2026 09:31
Comment thread modules/@shopify/checkout-sheet-kit/RNShopifyCheckoutSheetKit.podspec Outdated
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the cx-rn-new-arch-plan branch 2 times, most recently from fdb9158 to c99a638 Compare April 17, 2026 13:33
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/03-30-featreplaceinteropwithnewarchcode branch 2 times, most recently from 83db6fb to d45eb12 Compare April 20, 2026 14:41
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/03-30-featreplaceinteropwithnewarchcode branch from d45eb12 to fa18e5f Compare May 1, 2026 10:17
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/03-30-featreplaceinteropwithnewarchcode branch 2 times, most recently from 0d43f55 to dc837d5 Compare May 5, 2026 17:17
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the cx-rn-new-arch-plan branch 2 times, most recently from 62d1bcf to dee8e5c Compare May 5, 2026 17:52
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/03-30-featreplaceinteropwithnewarchcode branch from dc837d5 to bf8dba6 Compare May 5, 2026 17:52
kieran-osgood-shopify and others added 10 commits May 5, 2026 18:06
…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).
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.
…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>
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>
Update test references from NativeModules.ShopifyCheckoutSheetKit to
TurboModuleRegistry.getEnforcing to match the production code path
established by this PR. Remove stale event emitter cleanup that was
specific to the old NativeModules mock shape.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaces the deprecated deep import `react-native/Libraries/Utilities/codegenNativeComponent`
with the top-level named import now exported from `react-native`.

The `react-native/Libraries/Types/CodegenTypes` import is preserved
because codegen's AST parser matches those type names statically —
it can't follow namespace or alias indirection. Suppressed the lint
warning on that one line with a note explaining why.

Also simplifies the jest setup: `codegenNativeComponent` is now mocked
alongside the rest of `react-native` in `__mocks__/react-native.ts`,
so the separate `__mocks__/codegenNativeComponent.ts` file and its
`moduleNameMapper` entry in `jest.config.js` are no longer needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
kieran-osgood-shopify and others added 4 commits May 5, 2026 17:02
Now that we're on TurboModules, the four promise-based methods (getConfig,
configureAcceleratedCheckouts, isAcceleratedCheckoutAvailable,
isApplePayAvailable) can use synchronous JSI dispatch. Their native
implementations are pure in-memory reads or state writes, so the Promise
wrapper was boilerplate that blocked readable call sites.

BREAKING CHANGE: Consumers must drop `await` from these calls.

- Spec: return ConfigurationResultSpec / boolean directly instead of Promise
- iOS Swift: remove resolve/reject, return NSDictionary / NSNumber
- Android: annotate with isBlockingSynchronousMethod = true, return directly
- Consumer API in src/index.ts and src/context.tsx: drop async / await
- Tests: replace mockResolvedValue with mockReturnValue, drop awaits
- Sample app: drop awaits in Cart and SettingsScreen

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The codegen spec returns colorScheme and logLevel as `string`, but the
consumer-facing Configuration type uses typed enums. Replace the previous
`as Configuration` cast with a parser that:

- Validates colorScheme/logLevel against known enum values, falling back
  to the safest default when the native side returns an unrecognised value
- Re-shapes the flat iOS color fields into the nested `colors.ios` shape
  so a round trip through setConfig preserves user overrides
- Omits undefined fields so consumers don't see spurious `title: undefined`

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Swift tests were still calling the four converted methods with
resolve/reject callbacks. Update them to call the sync API directly
and compare against the returned NSNumber/NSDictionary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/03-30-featreplaceinteropwithnewarchcode branch from bf8dba6 to 6ddb3e2 Compare May 5, 2026 21:07
@Juanita-Dash Juanita-Dash changed the base branch from cx-rn-new-arch-plan to graphite-base/456 May 6, 2026 18:07
@Juanita-Dash Juanita-Dash changed the base branch from graphite-base/456 to main May 6, 2026 18:08
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.

4 participants