Skip to content

Commit

Permalink
Prevent iOS host object installation from getting the wrong bridge (s…
Browse files Browse the repository at this point in the history
…oftware-mansion#2146)


Similar to
software-mansion/react-native-reanimated#5953,
using `[RCTBridge currentBridge]` may lead to the wrong bridge in apps
that have multiple React instances, as is the case for expo-dev-client.
This results in apps sometimes crashing when reloading the bundle after
interacting with the DevMenu.
  • Loading branch information
gabrieldonadel authored and ja1ns committed Oct 9, 2024
1 parent 01aa6ea commit d759743
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ios/RNSModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ - (void)installHostObject
because depending on the selected architecture, only one method will be called.
For `Paper`, it will be constantsToExport, and for `Fabric`, it will be getTurboModule.
*/
RCTBridge *bridge = [RCTBridge currentBridge];
RCTCxxBridge *cxxBridge = (RCTCxxBridge *)bridge;
RCTCxxBridge *cxxBridge = (RCTCxxBridge *)self.bridge;
if (cxxBridge != nil) {
auto jsiRuntime = (jsi::Runtime *)cxxBridge.runtime;
if (jsiRuntime != nil) {
Expand Down

0 comments on commit d759743

Please sign in to comment.