Skip to content

fix(ios): support Bridgeless mode via self.bridge and RCTCallInvokerModule#326

Merged
wcandillon merged 2 commits intowcandillon:mainfrom
kessenma:fix/ios-bridgeless-mode
Feb 27, 2026
Merged

fix(ios): support Bridgeless mode via self.bridge and RCTCallInvokerModule#326
wcandillon merged 2 commits intowcandillon:mainfrom
kessenma:fix/ios-bridgeless-mode

Conversation

@kessenma
Copy link
Copy Markdown
Contributor

Summary

  • Replace [RCTBridge currentBridge] (returns nil in Bridgeless mode) with self.bridge.runtime, which works in both Legacy (RCTBridge) and Bridgeless (RCTBridgeProxy) modes
  • Conform WebGPUModule to RCTCallInvokerModule so the TurboModule infra injects the CallInvoker (instead of reading it from cxxBridge.jsCallInvoker)
  • Guard the RNWebGPU global access in JS so a failed install() produces a warning instead of crashing

Problem

Bridgeless mode is forced in React Native 0.84+ and default-on since 0.82. In Bridgeless mode, [RCTBridge currentBridge] returns nil, so install() silently returns NO and RNWebGPU is never installed — JS crashes with ReferenceError: Property 'RNWebGPU' doesn't exist.

Approach

This follows the same pattern used by react-native-reanimated, react-native-mmkv, and other JSI modules:

  1. Use self.bridge.runtime (instance property) instead of [RCTBridge currentBridge] (class method)
  2. Conform to RCTCallInvokerModule to receive the injected CallInvoker

Works identically in both Legacy and Bridgeless — no behavior change for existing users.

Test plan

  • Tested on React Native 0.84.0, Bridgeless mode (forced), iOS Simulator
  • install() returns true
  • navigator.gpu is defined
  • WebGPU Canvas renders correctly
  • Android unaffected (no changes needed — JavaScriptContextHolder already works in both architectures)

🤖 Generated with Claude Code

…okerModule

In Bridgeless mode (forced in RN 0.84+), [RCTBridge currentBridge] returns nil,
causing install() to silently fail and the RNWebGPU JSI global to never be set.

Replace the class method with self.bridge.runtime (works in both Legacy and
Bridgeless via RCTBridgeProxy) and conform to RCTCallInvokerModule so the
TurboModule infra injects the CallInvoker. Also guard the RNWebGPU global
access in JS so a failed install() doesn't crash the module require.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wcandillon wcandillon merged commit df7bdcc into wcandillon:main Feb 27, 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.

2 participants