Skip to content

Commit f6f4615

Browse files
cipolleschifacebook-github-bot
authored andcommitted
Make [RCTBridge currentBridge] work also inBridgeless for backward compatibility. (#42940)
Summary: Pull Request resolved: #42940 We might have some libraries that goes through the interop layer that are using [RCTBridge currentBridge]. Although this is an API that we would like them not to use, that's the sad reality and if we don't want to force a migration on those libraries, we need to be backward compatible. This diff sets the `RCTBridgeProxy` as the `currentBridge` in case the app is running in BridgelessMode. This should make Bridgeless backward compatible. ## Changelog [iOS][Fixed] - Make [RCTBridge currentBridge] work in bridgeless mode Reviewed By: RSNara Differential Revision: D53575361 fbshipit-source-id: 179e440662b577954a577e8400e0ce0dc5b4d3ff
1 parent 5fbdc99 commit f6f4615

File tree

1 file changed

+2
-0
lines changed
  • packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon

1 file changed

+2
-0
lines changed

packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#import <React/NSDataBigString.h>
1414
#import <React/RCTAssert.h>
15+
#import <React/RCTBridge+Private.h>
1516
#import <React/RCTBridge.h>
1617
#import <React/RCTBridgeModule.h>
1718
#import <React/RCTBridgeModuleDecorator.h>
@@ -263,6 +264,7 @@ - (void)_start
263264
[strongSelf registerSegmentWithId:segmentId path:path];
264265
}
265266
}];
267+
[RCTBridge setCurrentBridge:(RCTBridge *)bridgeProxy];
266268

267269
// Set up TurboModules
268270
_turboModuleManager = [[RCTTurboModuleManager alloc]

0 commit comments

Comments
 (0)