From 94e227d0c826f2d6469faf9503937b6bc5ec9b0f Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 20 Oct 2026 17:54:13 -0700 Subject: [PATCH 1/4] Remove dead RCTBridge synthesis from four bridgeless modules Summary: RCTDevMenu, RCTLogBox, RCTRedBox, and RCTBlobManager synthesized the deprecated bridge property but never read it. They use moduleRegistry, bundleManager, and callableJSModules instead. Changelog: [Internal] Differential Revision: D126545276 --- packages/react-native/Libraries/Blob/RCTBlobManager.mm | 1 - packages/react-native/React/CoreModules/RCTDevMenu.mm | 1 - packages/react-native/React/CoreModules/RCTLogBox.mm | 2 -- packages/react-native/React/CoreModules/RCTRedBox.mm | 1 - 4 files changed, 5 deletions(-) diff --git a/packages/react-native/Libraries/Blob/RCTBlobManager.mm b/packages/react-native/Libraries/Blob/RCTBlobManager.mm index 4a29b1f826c9..3699a727028d 100755 --- a/packages/react-native/Libraries/Blob/RCTBlobManager.mm +++ b/packages/react-native/Libraries/Blob/RCTBlobManager.mm @@ -46,7 +46,6 @@ @implementation RCTBlobManager { RCT_EXPORT_MODULE(BlobModule) -@synthesize bridge = _bridge; @synthesize moduleRegistry = _moduleRegistry; @synthesize methodQueue = _methodQueue; diff --git a/packages/react-native/React/CoreModules/RCTDevMenu.mm b/packages/react-native/React/CoreModules/RCTDevMenu.mm index 883b4ba7f8e1..bd946190df6b 100644 --- a/packages/react-native/React/CoreModules/RCTDevMenu.mm +++ b/packages/react-native/React/CoreModules/RCTDevMenu.mm @@ -119,7 +119,6 @@ @implementation RCTDevMenu { NSMutableArray *_extraMenuItems; } -@synthesize bridge = _bridge; @synthesize moduleRegistry = _moduleRegistry; @synthesize callableJSModules = _callableJSModules; @synthesize bundleManager = _bundleManager; diff --git a/packages/react-native/React/CoreModules/RCTLogBox.mm b/packages/react-native/React/CoreModules/RCTLogBox.mm index 7e8be47170dd..9741dc29c877 100644 --- a/packages/react-native/React/CoreModules/RCTLogBox.mm +++ b/packages/react-native/React/CoreModules/RCTLogBox.mm @@ -25,8 +25,6 @@ @implementation RCTLogBox { __weak id _bridgelessSurfacePresenter; } -@synthesize bridge = _bridge; - RCT_EXPORT_MODULE() + (BOOL)requiresMainQueueSetup diff --git a/packages/react-native/React/CoreModules/RCTRedBox.mm b/packages/react-native/React/CoreModules/RCTRedBox.mm index f2edecee813d..cc1b00688f1e 100644 --- a/packages/react-native/React/CoreModules/RCTRedBox.mm +++ b/packages/react-native/React/CoreModules/RCTRedBox.mm @@ -40,7 +40,6 @@ @implementation RCTRedBox { NSMutableArray *_customButtonHandlers; } -@synthesize bridge = _bridge; @synthesize moduleRegistry = _moduleRegistry; @synthesize bundleManager = _bundleManager; From ff7a25fb0a8429157adf4966c957ae4f58da13ff Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 20 Oct 2026 18:42:29 -0700 Subject: [PATCH 2/4] Remove dead RCTBridge imports from sixteen bridgeless files Summary: Seven implementation files imported the bridge header without referencing any symbol it provides. Nine public headers either imported it redundantly or narrowed it to the module protocol header they actually need. Changelog: [Internal] Differential Revision: D126549484 --- packages/react-native/Libraries/Blob/RCTBlobManager.h | 1 - packages/react-native/Libraries/Blob/RCTFileReaderModule.mm | 1 - packages/react-native/Libraries/Image/RCTImageDataDecoder.h | 2 +- packages/react-native/Libraries/Image/RCTImageLoaderProtocol.h | 1 - packages/react-native/Libraries/Image/RCTImageURLLoader.h | 2 +- .../Libraries/PushNotificationIOS/RCTPushNotificationManager.mm | 1 - packages/react-native/Libraries/Settings/RCTSettingsManager.mm | 1 - packages/react-native/React/CoreModules/RCTActionSheetManager.h | 2 +- .../react-native/React/CoreModules/RCTActionSheetManager.mm | 1 - packages/react-native/React/CoreModules/RCTAppState.mm | 1 - packages/react-native/React/CoreModules/RCTDevLoadingView.mm | 1 - packages/react-native/React/CoreModules/RCTDeviceInfo.h | 2 +- packages/react-native/React/CoreModules/RCTEventDispatcher.h | 1 - packages/react-native/React/CoreModules/RCTLogBox.h | 1 + packages/react-native/React/CoreModules/RCTLogBox.mm | 2 +- packages/react-native/React/CoreModules/RCTLogBoxView.h | 1 - 16 files changed, 6 insertions(+), 15 deletions(-) diff --git a/packages/react-native/Libraries/Blob/RCTBlobManager.h b/packages/react-native/Libraries/Blob/RCTBlobManager.h index 59659b6ac9ce..100ea51a5df1 100755 --- a/packages/react-native/Libraries/Blob/RCTBlobManager.h +++ b/packages/react-native/Libraries/Blob/RCTBlobManager.h @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -#import #import #import #import diff --git a/packages/react-native/Libraries/Blob/RCTFileReaderModule.mm b/packages/react-native/Libraries/Blob/RCTFileReaderModule.mm index c33e1c05893b..630750684091 100644 --- a/packages/react-native/Libraries/Blob/RCTFileReaderModule.mm +++ b/packages/react-native/Libraries/Blob/RCTFileReaderModule.mm @@ -8,7 +8,6 @@ #import #import -#import #import #import diff --git a/packages/react-native/Libraries/Image/RCTImageDataDecoder.h b/packages/react-native/Libraries/Image/RCTImageDataDecoder.h index 1f52b4a07e7f..b8941897a115 100644 --- a/packages/react-native/Libraries/Image/RCTImageDataDecoder.h +++ b/packages/react-native/Libraries/Image/RCTImageDataDecoder.h @@ -7,7 +7,7 @@ #import -#import +#import #import #import #import diff --git a/packages/react-native/Libraries/Image/RCTImageLoaderProtocol.h b/packages/react-native/Libraries/Image/RCTImageLoaderProtocol.h index 17bc12cc7e37..a93b68f962d7 100644 --- a/packages/react-native/Libraries/Image/RCTImageLoaderProtocol.h +++ b/packages/react-native/Libraries/Image/RCTImageLoaderProtocol.h @@ -7,7 +7,6 @@ #import -#import #import #import #import diff --git a/packages/react-native/Libraries/Image/RCTImageURLLoader.h b/packages/react-native/Libraries/Image/RCTImageURLLoader.h index d0299d3fcd6a..86daffc091c7 100644 --- a/packages/react-native/Libraries/Image/RCTImageURLLoader.h +++ b/packages/react-native/Libraries/Image/RCTImageURLLoader.h @@ -7,7 +7,7 @@ #import -#import +#import #import NS_ASSUME_NONNULL_BEGIN diff --git a/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm b/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm index 25c2867c9c85..8731cf6c0cea 100644 --- a/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +++ b/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm @@ -10,7 +10,6 @@ #import #import -#import #import #import diff --git a/packages/react-native/Libraries/Settings/RCTSettingsManager.mm b/packages/react-native/Libraries/Settings/RCTSettingsManager.mm index af0bd521f02e..212ea5a72f04 100644 --- a/packages/react-native/Libraries/Settings/RCTSettingsManager.mm +++ b/packages/react-native/Libraries/Settings/RCTSettingsManager.mm @@ -8,7 +8,6 @@ #import #import -#import #import #import #import diff --git a/packages/react-native/React/CoreModules/RCTActionSheetManager.h b/packages/react-native/React/CoreModules/RCTActionSheetManager.h index 338310b89c08..5ced60a6fe8c 100644 --- a/packages/react-native/React/CoreModules/RCTActionSheetManager.h +++ b/packages/react-native/React/CoreModules/RCTActionSheetManager.h @@ -7,7 +7,7 @@ #import -#import +#import @interface RCTActionSheetManager : NSObject diff --git a/packages/react-native/React/CoreModules/RCTActionSheetManager.mm b/packages/react-native/React/CoreModules/RCTActionSheetManager.mm index 104e0491fc22..d615eca6e8a3 100644 --- a/packages/react-native/React/CoreModules/RCTActionSheetManager.mm +++ b/packages/react-native/React/CoreModules/RCTActionSheetManager.mm @@ -13,7 +13,6 @@ #if !TARGET_OS_TV -#import #import #import #import diff --git a/packages/react-native/React/CoreModules/RCTAppState.mm b/packages/react-native/React/CoreModules/RCTAppState.mm index 7ca35bfefefd..c57bf83b6928 100644 --- a/packages/react-native/React/CoreModules/RCTAppState.mm +++ b/packages/react-native/React/CoreModules/RCTAppState.mm @@ -9,7 +9,6 @@ #import #import -#import #import #import #import diff --git a/packages/react-native/React/CoreModules/RCTDevLoadingView.mm b/packages/react-native/React/CoreModules/RCTDevLoadingView.mm index 100dc3ce064e..9b3620cb9b91 100644 --- a/packages/react-native/React/CoreModules/RCTDevLoadingView.mm +++ b/packages/react-native/React/CoreModules/RCTDevLoadingView.mm @@ -12,7 +12,6 @@ #import #import -#import #import #import #import diff --git a/packages/react-native/React/CoreModules/RCTDeviceInfo.h b/packages/react-native/React/CoreModules/RCTDeviceInfo.h index 66c2d3218552..f3bdd908c7f2 100644 --- a/packages/react-native/React/CoreModules/RCTDeviceInfo.h +++ b/packages/react-native/React/CoreModules/RCTDeviceInfo.h @@ -7,7 +7,7 @@ #import -#import +#import @interface RCTDeviceInfo : NSObject diff --git a/packages/react-native/React/CoreModules/RCTEventDispatcher.h b/packages/react-native/React/CoreModules/RCTEventDispatcher.h index 3b31791ae73d..837c68836280 100644 --- a/packages/react-native/React/CoreModules/RCTEventDispatcher.h +++ b/packages/react-native/React/CoreModules/RCTEventDispatcher.h @@ -7,7 +7,6 @@ #import -#import #import #import /** diff --git a/packages/react-native/React/CoreModules/RCTLogBox.h b/packages/react-native/React/CoreModules/RCTLogBox.h index 17f7f4d98ef8..c42b9811099d 100644 --- a/packages/react-native/React/CoreModules/RCTLogBox.h +++ b/packages/react-native/React/CoreModules/RCTLogBox.h @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +#import #import #import "RCTLogBoxView.h" diff --git a/packages/react-native/React/CoreModules/RCTLogBox.mm b/packages/react-native/React/CoreModules/RCTLogBox.mm index 9741dc29c877..cdadc87c601c 100644 --- a/packages/react-native/React/CoreModules/RCTLogBox.mm +++ b/packages/react-native/React/CoreModules/RCTLogBox.mm @@ -8,8 +8,8 @@ #import "RCTLogBox.h" #import -#import #import +#import #import #import #import diff --git a/packages/react-native/React/CoreModules/RCTLogBoxView.h b/packages/react-native/React/CoreModules/RCTLogBoxView.h index 56d0d7ba84ef..29bf90af5ff5 100644 --- a/packages/react-native/React/CoreModules/RCTLogBoxView.h +++ b/packages/react-native/React/CoreModules/RCTLogBoxView.h @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -#import #import #import #import From e4f4b50a8b1b28a9fbe927131385d927dc33dba7 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 20 Oct 2026 19:17:38 -0700 Subject: [PATCH 3/4] Drop RCTBridge reads from five new-arch-only modules Summary: RCTEventDispatcher routes via _dispatchToJSThread; RCTImageLoader and RCTNetworking require their registry-backed providers; RCTTestModule uses the injected viewRegistry_DEPRECATED; RCTViewManager drops a no-op registry write. Legacy RCTBridge is a stub, so these reads only reached RCTBridgeProxy shims. Differential Revision: D126558187 --- .../Libraries/Image/RCTImageLoader.mm | 19 ++++------------- .../Libraries/Network/RCTNetworking.mm | 5 ++--- .../React/CoreModules/RCTEventDispatcher.mm | 9 +------- .../react-native/React/Views/RCTViewManager.m | 1 - packages/rn-tester/RCTTest/RCTTestModule.mm | 21 +++++-------------- 5 files changed, 12 insertions(+), 43 deletions(-) diff --git a/packages/react-native/Libraries/Image/RCTImageLoader.mm b/packages/react-native/Libraries/Image/RCTImageLoader.mm index db468e7d4d0c..9dab28583942 100644 --- a/packages/react-native/Libraries/Image/RCTImageLoader.mm +++ b/packages/react-native/Libraries/Image/RCTImageLoader.mm @@ -85,7 +85,6 @@ @implementation RCTImageLoader { __weak id _redirectDelegate; } -@synthesize bridge = _bridge; @synthesize moduleRegistry = _moduleRegistry; @synthesize maxConcurrentLoadingTasks = _maxConcurrentLoadingTasks; @synthesize maxConcurrentDecodingTasks = _maxConcurrentDecodingTasks; @@ -134,13 +133,8 @@ - (void)setUp _URLRequestQueue = dispatch_queue_create("com.facebook.react.ImageLoaderURLRequestQueue", DISPATCH_QUEUE_SERIAL); - // Get loaders, sorted in reverse priority order (highest priority first) - if (_loadersProvider != nil) { - _loaders = _loadersProvider(self.moduleRegistry); - } else { - RCTAssert(_bridge, @"Trying to find RCTImageURLLoaders and bridge not set."); - _loaders = [_bridge modulesConformingToProtocol:@protocol(RCTImageURLLoader)]; - } + RCTAssert(_loadersProvider != nil, @"Trying to find RCTImageURLLoaders and loaders provider not set."); + _loaders = _loadersProvider(self.moduleRegistry); _loaders = [_loaders sortedArrayUsingComparator:^NSComparisonResult(id a, id b) { float priorityA = [a respondsToSelector:@selector(loaderPriority)] ? [a loaderPriority] : 0; @@ -154,13 +148,8 @@ - (void)setUp } }]; - // Get decoders, sorted in reverse priority order (highest priority first) - if (_decodersProvider != nil) { - _decoders = _decodersProvider(self.moduleRegistry); - } else { - RCTAssert(_bridge, @"Trying to find RCTImageDataDecoders and bridge not set."); - _decoders = [_bridge modulesConformingToProtocol:@protocol(RCTImageDataDecoder)]; - } + RCTAssert(_decodersProvider != nil, @"Trying to find RCTImageDataDecoders and decoders provider not set."); + _decoders = _decodersProvider(self.moduleRegistry); _decoders = [_decoders sortedArrayUsingComparator:^NSComparisonResult(id a, id b) { float priorityA = [a respondsToSelector:@selector(decoderPriority)] ? [a decoderPriority] : 0; diff --git a/packages/react-native/Libraries/Network/RCTNetworking.mm b/packages/react-native/Libraries/Network/RCTNetworking.mm index 8cfdecd57d5c..95e531d4e49a 100644 --- a/packages/react-native/Libraries/Network/RCTNetworking.mm +++ b/packages/react-native/Libraries/Network/RCTNetworking.mm @@ -271,9 +271,8 @@ - (void)invalidate return _handlers; } - NSArray> *newHandlers = _handlersProvider - ? _handlersProvider(self.moduleRegistry) - : [self.bridge modulesConformingToProtocol:@protocol(RCTURLRequestHandler)]; + RCTAssert(_handlersProvider != nil, @"Trying to find RCTURLRequestHandlers and handlers provider not set."); + NSArray> *newHandlers = _handlersProvider(self.moduleRegistry); // Get handlers, sorted in reverse priority order (highest priority first) newHandlers = [newHandlers diff --git a/packages/react-native/React/CoreModules/RCTEventDispatcher.mm b/packages/react-native/React/CoreModules/RCTEventDispatcher.mm index 770c746c0bf5..9f8bb3306f0c 100644 --- a/packages/react-native/React/CoreModules/RCTEventDispatcher.mm +++ b/packages/react-native/React/CoreModules/RCTEventDispatcher.mm @@ -40,7 +40,6 @@ @implementation RCTEventDispatcher { NSRecursiveLock *_observersLock; } -@synthesize bridge = _bridge; @synthesize dispatchToJSThread = _dispatchToJSThread; @synthesize callableJSModules = _callableJSModules; @@ -175,13 +174,7 @@ - (void)sendEvent:(id)event [_eventQueueLock unlock]; if (scheduleEventsDispatch) { - if (_bridge != nullptr) { - [_bridge - dispatchBlock:^{ - [self flushEventsQueue]; - } - queue:RCTJSThread]; - } else if (_dispatchToJSThread != nullptr) { + if (_dispatchToJSThread != nullptr) { _dispatchToJSThread(^{ [self flushEventsQueue]; }); diff --git a/packages/react-native/React/Views/RCTViewManager.m b/packages/react-native/React/Views/RCTViewManager.m index fa1e0bcc95b9..2cb5281e0ee8 100644 --- a/packages/react-native/React/Views/RCTViewManager.m +++ b/packages/react-native/React/Views/RCTViewManager.m @@ -322,7 +322,6 @@ - (void)updateAccessibilityTraitsForRole:(RCTView *)view withDefaultView:(RCTVie RCT_CUSTOM_VIEW_PROPERTY(nativeID, NSString *, RCTView) { view.nativeID = json ? [RCTConvert NSString:json] : defaultView.nativeID; - [_bridge.uiManager setNativeID:view.nativeID forView:view]; } RCT_CUSTOM_VIEW_PROPERTY(pointerEvents, RCTPointerEvents, RCTView) diff --git a/packages/rn-tester/RCTTest/RCTTestModule.mm b/packages/rn-tester/RCTTest/RCTTestModule.mm index fb5e4a0cc148..4276d33dd77f 100644 --- a/packages/rn-tester/RCTTest/RCTTestModule.mm +++ b/packages/rn-tester/RCTTest/RCTTestModule.mm @@ -90,26 +90,16 @@ @implementation RCTTestModule { NSMutableDictionary *_snapshotCounter; } -@synthesize bridge = _bridge; @synthesize moduleRegistry = _moduleRegistry; +@synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED; RCT_EXPORT_MODULE() -- (dispatch_queue_t)methodQueue -{ - return _bridge.uiManager.methodQueue; -} - -- (void)setMethodQueue:(dispatch_queue_t)methodQueue -{ - // noop -} - - (void)verifySnapshot:(RCTResponseSenderBlock)callback { RCTAssert(_controller != nil, @"No snapshot controller configured."); - [_bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { + [_viewRegistry_DEPRECATED addUIBlock:^(__unused RCTViewRegistry *viewRegistry) { NSString *testName = NSStringFromSelector(self->_testSelector); if (!self->_snapshotCounter) { self->_snapshotCounter = [NSMutableDictionary new]; @@ -163,10 +153,9 @@ - (void)markTestCompleted - (void)markTestPassed:(BOOL)success { - [_bridge.uiManager - addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { - self->_status = success ? RCTTestStatusPassed : RCTTestStatusFailed; - }]; + [_viewRegistry_DEPRECATED addUIBlock:^(__unused RCTViewRegistry *viewRegistry) { + self->_status = success ? RCTTestStatusPassed : RCTTestStatusFailed; + }]; } - (std::shared_ptr)getTurboModule: From b8266287390522982c42aa7cc7c441f7c926b016 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 20 Oct 2026 20:38:57 -0700 Subject: [PATCH 4/4] Add launchOptions and performanceLogger module injection Summary: Extend RCTBridgeModule with optional launchOptions and performanceLogger properties, injected through RCTBridgeModuleDecorator from RCTInstance. This lets TurboModules read launch configuration and perf events without touching the deprecated bridge property. Changelog: [iOS][Added] - Add injectable launchOptions and performanceLogger module APIs Differential Revision: D126567157 --- .../react-native/React/Base/RCTBridgeModule.h | 20 ++++++++++++++ .../React/Base/RCTBridgeModuleDecorator.h | 7 ++++- .../React/Base/RCTBridgeModuleDecorator.m | 26 +++++++++++++++++++ .../platform/ios/ReactCommon/RCTInstance.mm | 4 ++- .../api-snapshots/ReactAppleDebugCxx.api | 6 ++++- .../api-snapshots/ReactAppleFrameworksCxx.api | 6 ++++- .../api-snapshots/ReactAppleNewarchCxx.api | 6 ++++- .../api-snapshots/ReactAppleReleaseCxx.api | 6 ++++- 8 files changed, 75 insertions(+), 6 deletions(-) diff --git a/packages/react-native/React/Base/RCTBridgeModule.h b/packages/react-native/React/Base/RCTBridgeModule.h index 14c479b25bd0..9fc86cdeed25 100644 --- a/packages/react-native/React/Base/RCTBridgeModule.h +++ b/packages/react-native/React/Base/RCTBridgeModule.h @@ -22,6 +22,7 @@ @class RCTModuleRegistry; @class RCTViewRegistry; @class RCTCallableJSModules; +@class RCTPerformanceLogger; /** * The type of a block that is capable of sending a response to a bridged @@ -168,6 +169,25 @@ RCT_EXTERN_C_END */ @property (nonatomic, weak, readwrite) RCTCallableJSModules *callableJSModules; +/** + * The launch options that were used to initialize the React instance. + * Useful for modules that need to read launch-time configuration. + * + * To implement this in your module, just add `@synthesize launchOptions = + * _launchOptions;`. If using Swift, add `@objc var launchOptions: + * NSDictionary!` to your module. + */ +@property (nonatomic, copy, readwrite) NSDictionary *launchOptions; + +/** + * Link to the Performance Logger that logs React Native perf events. + * + * To implement this in your module, just add `@synthesize performanceLogger = + * _performanceLogger;`. If using Swift, add `@objc var performanceLogger: + * RCTPerformanceLogger!` to your module. + */ +@property (nonatomic, strong, readwrite) RCTPerformanceLogger *performanceLogger; + /** * A reference to the RCTBridge. Useful for modules that require access * to bridge features, such as sending events or making JS calls. This diff --git a/packages/react-native/React/Base/RCTBridgeModuleDecorator.h b/packages/react-native/React/Base/RCTBridgeModuleDecorator.h index e7860967d1a7..c641caacbabf 100644 --- a/packages/react-native/React/Base/RCTBridgeModuleDecorator.h +++ b/packages/react-native/React/Base/RCTBridgeModuleDecorator.h @@ -10,6 +10,7 @@ @class RCTBundleManager; @class RCTCallableJSModules; @class RCTModuleRegistry; +@class RCTPerformanceLogger; @class RCTViewRegistry; /** @@ -24,11 +25,15 @@ @property (nonatomic, strong, readonly) RCTModuleRegistry *moduleRegistry; @property (nonatomic, strong, readonly) RCTBundleManager *bundleManager; @property (nonatomic, strong, readonly) RCTCallableJSModules *callableJSModules; +@property (nonatomic, copy, readonly) NSDictionary *launchOptions; +@property (nonatomic, strong, readonly) RCTPerformanceLogger *performanceLogger; - (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry moduleRegistry:(RCTModuleRegistry *)moduleRegistry bundleManager:(RCTBundleManager *)bundleManager - callableJSModules:(RCTCallableJSModules *)callableJSModules; + callableJSModules:(RCTCallableJSModules *)callableJSModules + launchOptions:(NSDictionary *)launchOptions + performanceLogger:(RCTPerformanceLogger *)performanceLogger; - (void)attachInteropAPIsToModule:(id)bridgeModule; diff --git a/packages/react-native/React/Base/RCTBridgeModuleDecorator.m b/packages/react-native/React/Base/RCTBridgeModuleDecorator.m index 7f8e15417bc2..c278b28911c5 100644 --- a/packages/react-native/React/Base/RCTBridgeModuleDecorator.m +++ b/packages/react-native/React/Base/RCTBridgeModuleDecorator.m @@ -13,12 +13,16 @@ - (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry moduleRegistry:(RCTModuleRegistry *)moduleRegistry bundleManager:(RCTBundleManager *)bundleManager callableJSModules:(RCTCallableJSModules *)callableJSModules + launchOptions:(NSDictionary *)launchOptions + performanceLogger:(RCTPerformanceLogger *)performanceLogger { if (self = [super init]) { _viewRegistry_DEPRECATED = viewRegistry; _moduleRegistry = moduleRegistry; _bundleManager = bundleManager; _callableJSModules = callableJSModules; + _launchOptions = [launchOptions copy]; + _performanceLogger = performanceLogger; } return self; } @@ -68,6 +72,28 @@ - (void)attachInteropAPIsToModule:(id)bridgeModule if ([bridgeModule respondsToSelector:@selector(setModuleRegistry:)]) { bridgeModule.moduleRegistry = _moduleRegistry; } + + /** + * Attach the launch options to this TurboModule, which allows this TurboModule + * to read the launch-time configuration of the React instance. + * + * Usage: In the TurboModule @implementation, include: + * `@synthesize launchOptions = _launchOptions` + */ + if ([bridgeModule respondsToSelector:@selector(setLaunchOptions:)]) { + bridgeModule.launchOptions = _launchOptions; + } + + /** + * Attach the RCTPerformanceLogger to this TurboModule, which allows this + * TurboModule to read React Native perf events. + * + * Usage: In the TurboModule @implementation, include: + * `@synthesize performanceLogger = _performanceLogger` + */ + if ([bridgeModule respondsToSelector:@selector(setPerformanceLogger:)]) { + bridgeModule.performanceLogger = _performanceLogger; + } } @end diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm index 5efe16f73de6..40480593c587 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm @@ -129,7 +129,9 @@ - (instancetype)initWithDelegate:(id)delegate _bridgeModuleDecorator = [[RCTBridgeModuleDecorator alloc] initWithViewRegistry:[RCTViewRegistry new] moduleRegistry:moduleRegistry bundleManager:bundleManager - callableJSModules:[RCTCallableJSModules new]]; + callableJSModules:[RCTCallableJSModules new] + launchOptions:launchOptions + performanceLogger:_performanceLogger]; _devMenuConfigurationDecorator = #if RCT_DEV_MENU [[RCTDevMenuConfigurationDecorator alloc] initWithDevMenuConfiguration:devMenuConfiguration]; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index cd7cd6ba81f9..0669fff91c01 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -703,10 +703,12 @@ interface RCTBridge : public NSObject { } interface RCTBridgeModuleDecorator : public NSObject { + public @property (copy, readonly) NSDictionary* launchOptions; public @property (strong, readonly) RCTBundleManager* bundleManager; public @property (strong, readonly) RCTCallableJSModules* callableJSModules; public @property (strong, readonly) RCTModuleRegistry* moduleRegistry; - public virtual instancetype initWithViewRegistry:moduleRegistry:bundleManager:callableJSModules:(RCTViewRegistry* viewRegistry, RCTModuleRegistry* moduleRegistry, RCTBundleManager* bundleManager, RCTCallableJSModules* callableJSModules); + public @property (strong, readonly) RCTPerformanceLogger* performanceLogger; + public virtual instancetype initWithViewRegistry:moduleRegistry:bundleManager:callableJSModules:launchOptions:performanceLogger:(RCTViewRegistry* viewRegistry, RCTModuleRegistry* moduleRegistry, RCTBundleManager* bundleManager, RCTCallableJSModules* callableJSModules, NSDictionary* launchOptions, RCTPerformanceLogger* performanceLogger); public virtual void attachInteropAPIsToModule:(id bridgeModule); } @@ -2555,6 +2557,8 @@ protocol RCTBridgeMethod : public NSObject { } protocol RCTBridgeModule : public NSObject { + public @property (copy) NSDictionary* launchOptions; + public @property (strong) RCTPerformanceLogger* performanceLogger; public @property (strong, readonly) dispatch_queue_t methodQueue; public @property (weak) RCTBundleManager* bundleManager; public @property (weak) RCTCallableJSModules* callableJSModules; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api index a21ebf068233..1a5b4a36f5f7 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api @@ -712,10 +712,12 @@ interface RCTBridge : public NSObject { } interface RCTBridgeModuleDecorator : public NSObject { + public @property (copy, readonly) NSDictionary* launchOptions; public @property (strong, readonly) RCTBundleManager* bundleManager; public @property (strong, readonly) RCTCallableJSModules* callableJSModules; public @property (strong, readonly) RCTModuleRegistry* moduleRegistry; - public virtual instancetype initWithViewRegistry:moduleRegistry:bundleManager:callableJSModules:(RCTViewRegistry* viewRegistry, RCTModuleRegistry* moduleRegistry, RCTBundleManager* bundleManager, RCTCallableJSModules* callableJSModules); + public @property (strong, readonly) RCTPerformanceLogger* performanceLogger; + public virtual instancetype initWithViewRegistry:moduleRegistry:bundleManager:callableJSModules:launchOptions:performanceLogger:(RCTViewRegistry* viewRegistry, RCTModuleRegistry* moduleRegistry, RCTBundleManager* bundleManager, RCTCallableJSModules* callableJSModules, NSDictionary* launchOptions, RCTPerformanceLogger* performanceLogger); public virtual void attachInteropAPIsToModule:(id bridgeModule); } @@ -2613,6 +2615,8 @@ protocol RCTBridgeMethod : public NSObject { } protocol RCTBridgeModule : public NSObject { + public @property (copy) NSDictionary* launchOptions; + public @property (strong) RCTPerformanceLogger* performanceLogger; public @property (strong, readonly) dispatch_queue_t methodQueue; public @property (weak) RCTBundleManager* bundleManager; public @property (weak) RCTCallableJSModules* callableJSModules; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index aab9559c8f36..ceff567ed3c1 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -703,10 +703,12 @@ interface RCTBridge : public NSObject { } interface RCTBridgeModuleDecorator : public NSObject { + public @property (copy, readonly) NSDictionary* launchOptions; public @property (strong, readonly) RCTBundleManager* bundleManager; public @property (strong, readonly) RCTCallableJSModules* callableJSModules; public @property (strong, readonly) RCTModuleRegistry* moduleRegistry; - public virtual instancetype initWithViewRegistry:moduleRegistry:bundleManager:callableJSModules:(RCTViewRegistry* viewRegistry, RCTModuleRegistry* moduleRegistry, RCTBundleManager* bundleManager, RCTCallableJSModules* callableJSModules); + public @property (strong, readonly) RCTPerformanceLogger* performanceLogger; + public virtual instancetype initWithViewRegistry:moduleRegistry:bundleManager:callableJSModules:launchOptions:performanceLogger:(RCTViewRegistry* viewRegistry, RCTModuleRegistry* moduleRegistry, RCTBundleManager* bundleManager, RCTCallableJSModules* callableJSModules, NSDictionary* launchOptions, RCTPerformanceLogger* performanceLogger); public virtual void attachInteropAPIsToModule:(id bridgeModule); } @@ -2547,6 +2549,8 @@ protocol RCTBridgeMethod : public NSObject { } protocol RCTBridgeModule : public NSObject { + public @property (copy) NSDictionary* launchOptions; + public @property (strong) RCTPerformanceLogger* performanceLogger; public @property (strong, readonly) dispatch_queue_t methodQueue; public @property (weak) RCTBundleManager* bundleManager; public @property (weak) RCTCallableJSModules* callableJSModules; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index 47e70d959eb1..97204b78b340 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -703,10 +703,12 @@ interface RCTBridge : public NSObject { } interface RCTBridgeModuleDecorator : public NSObject { + public @property (copy, readonly) NSDictionary* launchOptions; public @property (strong, readonly) RCTBundleManager* bundleManager; public @property (strong, readonly) RCTCallableJSModules* callableJSModules; public @property (strong, readonly) RCTModuleRegistry* moduleRegistry; - public virtual instancetype initWithViewRegistry:moduleRegistry:bundleManager:callableJSModules:(RCTViewRegistry* viewRegistry, RCTModuleRegistry* moduleRegistry, RCTBundleManager* bundleManager, RCTCallableJSModules* callableJSModules); + public @property (strong, readonly) RCTPerformanceLogger* performanceLogger; + public virtual instancetype initWithViewRegistry:moduleRegistry:bundleManager:callableJSModules:launchOptions:performanceLogger:(RCTViewRegistry* viewRegistry, RCTModuleRegistry* moduleRegistry, RCTBundleManager* bundleManager, RCTCallableJSModules* callableJSModules, NSDictionary* launchOptions, RCTPerformanceLogger* performanceLogger); public virtual void attachInteropAPIsToModule:(id bridgeModule); } @@ -2555,6 +2557,8 @@ protocol RCTBridgeMethod : public NSObject { } protocol RCTBridgeModule : public NSObject { + public @property (copy) NSDictionary* launchOptions; + public @property (strong) RCTPerformanceLogger* performanceLogger; public @property (strong, readonly) dispatch_queue_t methodQueue; public @property (weak) RCTBundleManager* bundleManager; public @property (weak) RCTCallableJSModules* callableJSModules;