Skip to content

Commit

Permalink
Make [RCTBridge currentBridge] work also inBridgeless for backward co…
Browse files Browse the repository at this point in the history
…mpatibility. (#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
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Feb 9, 2024
1 parent 5fbdc99 commit f6f4615
Showing 1 changed file with 2 additions and 0 deletions.
Expand Up @@ -12,6 +12,7 @@

#import <React/NSDataBigString.h>
#import <React/RCTAssert.h>
#import <React/RCTBridge+Private.h>
#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTBridgeModuleDecorator.h>
Expand Down Expand Up @@ -263,6 +264,7 @@ - (void)_start
[strongSelf registerSegmentWithId:segmentId path:path];
}
}];
[RCTBridge setCurrentBridge:(RCTBridge *)bridgeProxy];

// Set up TurboModules
_turboModuleManager = [[RCTTurboModuleManager alloc]
Expand Down

0 comments on commit f6f4615

Please sign in to comment.