Skip to content

fix(apple): guard RCTCxxBridge with RCT_REMOVE_LEGACY_ARCH#3906

Merged
wcandillon merged 1 commit into
Shopify:mainfrom
chrfalch:fix/rctcxxbridge-remove-legacy-arch-macro
Jun 25, 2026
Merged

fix(apple): guard RCTCxxBridge with RCT_REMOVE_LEGACY_ARCH#3906
wcandillon merged 1 commit into
Shopify:mainfrom
chrfalch:fix/rctcxxbridge-remove-legacy-arch-macro

Conversation

@chrfalch

Copy link
Copy Markdown
Contributor

Summary

The legacy RCTCxxBridge branch in RNSkiaModule.mm is guarded by RCT_DISABLE_LEGACY_ARCH — a macro that does not exist in React Native. React Native compiles out RCTCxxBridge (from RCTBridge+Private.h) behind RCT_REMOVE_LEGACY_ARCH instead (react/react-native#56837).

Because the macro name never matches, the #ifndef guard is always true and the RCTCxxBridge branch is compiled in unconditionally. On React Native main — where RCT_REMOVE_LEGACY_ARCH is defined and RCTCxxBridge is fully removed — the iOS build fails:

RNSkiaModule.mm:40:5: error: unknown type name 'RCTCxxBridge'; did you mean 'RCTBridge'?
    RCTCxxBridge *cxxBridge = (RCTCxxBridge *)self.bridge;

This is what the React Native community nightly tests are currently flagging for @shopify/react-native-skia on iOS.

Fix

  • RNSkiaModule.mm: change the guard from RCT_DISABLE_LEGACY_ARCHRCT_REMOVE_LEGACY_ARCH. When the legacy arch is removed, the branch is dropped and the new-arch getTurboModule path already supplies jsInvoker.
  • SkiaManager.mm: fix the stale macro name in the explanatory comment (no code change there — it already avoids RCTCxxBridge via a forward-declared runtime accessor).

Test plan

  • Builds against current React Native main/nightly (where RCT_REMOVE_LEGACY_ARCH is set and RCTCxxBridge is absent).
  • Still builds on legacy/new-arch RN where RCTCxxBridge is available (macro undefined → branch retained, same as before).

🤖 Generated with Claude Code

React Native gates the removal of `RCTCxxBridge` (RCTBridge+Private.h)
behind `RCT_REMOVE_LEGACY_ARCH`, not `RCT_DISABLE_LEGACY_ARCH`. The
latter macro does not exist anywhere in React Native, so the `#ifndef`
guard was always true and the legacy `RCTCxxBridge` branch was compiled
in unconditionally.

On React Native main (where `RCT_REMOVE_LEGACY_ARCH` is defined and
`RCTCxxBridge` is fully compiled out) this fails to build:

    RNSkiaModule.mm:40:5: error: unknown type name 'RCTCxxBridge';
    did you mean 'RCTBridge'?

Switch the guard to the correct macro so the legacy branch is dropped
when the legacy architecture is removed; the new-arch getTurboModule
path already supplies jsInvoker in that configuration. Also fix the
stale macro name in the SkiaManager.mm comment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wcandillon wcandillon self-requested a review June 25, 2026 13:49
@wcandillon

Copy link
Copy Markdown
Contributor

@chrfalch Thanks a lot! Let me know if there is a workflow we could implement to test the package again latest RN nightly (we do it to test the package against Expo for instance: https://github.com/Shopify/react-native-skia/blob/main/.github/workflows/test-skia-package.yml).

@wcandillon wcandillon merged commit 9e8166b into Shopify:main Jun 25, 2026
24 of 27 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.6.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants