Skip to content

fix(🍏): gate RCTCxxBridge behind RCT_DISABLE_LEGACY_ARCH#3852

Open
wcandillon wants to merge 4 commits into
mainfrom
cxxbridge
Open

fix(🍏): gate RCTCxxBridge behind RCT_DISABLE_LEGACY_ARCH#3852
wcandillon wants to merge 4 commits into
mainfrom
cxxbridge

Conversation

@wcandillon
Copy link
Copy Markdown
Contributor

No description provided.

@wcandillon
Copy link
Copy Markdown
Contributor Author

@cipolleschi does this look good? which version of React Native should I try this on?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the iOS Skia integration to avoid directly referencing RCTCxxBridge (which can be compiled out when RCT_DISABLE_LEGACY_ARCH is enabled), by switching runtime access to a RCTBridge-level accessor and gating legacy-only jsInvoker wiring.

Changes:

  • SkiaManager.mm: stop casting to RCTCxxBridge and instead use a forward-declared RCTBridge runtime accessor.
  • RNSkiaModule.mm: wrap legacy RCTCxxBridge jsCallInvoker access behind #ifndef RCT_DISABLE_LEGACY_ARCH and pass self.bridge to SkiaManager.
  • Podfile.lock (example iOS app): large set of pod checksum updates and a CocoaPods version line change.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/skia/apple/SkiaManager.mm Removes direct RCTCxxBridge usage by accessing the JSI runtime via bridge.runtime.
packages/skia/apple/RNSkiaModule.mm Gates legacy RCTCxxBridge call-invoker wiring behind RCT_DISABLE_LEGACY_ARCH.
apps/example/ios/Podfile.lock Updates pod checksums and the recorded CocoaPods version for the example iOS app.
Comments suppressed due to low confidence (1)

packages/skia/apple/SkiaManager.mm:47

  • RNSkApplePlatformContext/RNSkPlatformContext assumes a non-null CallInvoker (it dereferences _callInvoker in runOnJavascriptThread() without checks). SkiaManager currently only gates on bridge.runtime; if jsInvoker is empty, _skManager will still be created with a platform context that can later crash when scheduling work on the JS thread. Consider also requiring jsInvoker to be set (or failing fast) before constructing RNSkManager/platform context.
    if (bridge.runtime) {
      facebook::jsi::Runtime *jsRuntime =
          (facebook::jsi::Runtime *)bridge.runtime;

      // Create the RNSkiaManager (cross platform)
      _skManager = std::make_shared<RNSkia::RNSkManager>(
          jsRuntime, jsInvoker,
          std::make_shared<RNSkia::RNSkApplePlatformContext>(bridge,
                                                             jsInvoker));

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/skia/apple/RNSkiaModule.mm
wcandillon and others added 2 commits May 23, 2026 14:25
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

2 participants