From bc338937d1d7e78cf871b8bb83582d4b7db6c01b Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 27 Oct 2026 07:09:48 -0700 Subject: [PATCH 1/5] Delete dead sourceURLForBridge delegate chain Summary: `sourceURLForBridge:` has no callers: the factory reads `bundleURL` directly, and the default delegate's implementations only threw or forwarded to each other. Delete the protocol method with those implementations and the factory's dead configuration assignment. The `RCTJavaScriptLoader.h` import stays: removing it breaks every `RCTBridge.h` importer that uses the loader types. Changelog: [iOS][Removed] - Remove deprecated `RCTBridgeDelegate` `sourceURLForBridge:` Differential Revision: D127294778 --- .../RCTDefaultReactNativeFactoryDelegate.mm | 14 -------------- .../Libraries/AppDelegate/RCTReactNativeFactory.mm | 5 ----- .../Libraries/AppDelegate/RCTRootViewFactory.h | 1 + .../react-native/React/Base/RCTBridgeDelegate.h | 11 ----------- packages/rn-tester/RNTester/SceneDelegate.mm | 5 ----- .../cxx-api/api-snapshots/ReactAppleDebugCxx.api | 1 - .../api-snapshots/ReactAppleFrameworksCxx.api | 1 - .../cxx-api/api-snapshots/ReactAppleReleaseCxx.api | 1 - 8 files changed, 1 insertion(+), 38 deletions(-) diff --git a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm index d94631a23d82..68c66feb8de2 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm @@ -26,13 +26,6 @@ @implementation RCTDefaultReactNativeFactoryDelegate { @synthesize dependencyProvider; -- (NSURL *_Nullable)sourceURLForBridge:(nonnull RCTBridge *)bridge -{ - [NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented" - format:@"Subclasses must implement a valid sourceURLForBridge method"]; - return nil; -} - - (UIViewController *)createRootViewController { return [UIViewController new]; @@ -126,11 +119,4 @@ - (Class)getModuleClassFromName:(const char *)name return nullptr; } -- (void)loadSourceForBridge:(RCTBridge *)bridge - onProgress:(RCTSourceLoadProgressBlock)onProgress - onComplete:(RCTSourceLoadBlock)loadCallback -{ - [RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback]; -} - @end diff --git a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm index e4ee18ccb518..deba936037f4 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm @@ -295,11 +295,6 @@ - (RCTRootViewFactory *)createRCTRootViewFactory [weakSelf.delegate customizeRootView:(RCTRootView *)rootView]; }; - configuration.sourceURLForBridge = ^NSURL *_Nullable(RCTBridge *_Nonnull bridge) - { - return [weakSelf.delegate bundleURL]; - }; - if ([self.delegate respondsToSelector:@selector(extraModulesForBridge:)]) { configuration.extraModulesForBridge = ^NSArray> *_Nonnull(RCTBridge *_Nonnull bridge) { diff --git a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h index 000963c81e1a..14334a2c102e 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h +++ b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h @@ -6,6 +6,7 @@ */ #import +#import #import #import #import "RCTJSRuntimeConfiguratorProtocol.h" diff --git a/packages/react-native/React/Base/RCTBridgeDelegate.h b/packages/react-native/React/Base/RCTBridgeDelegate.h index 9e5306f8fc7e..d5293d9f9db8 100644 --- a/packages/react-native/React/Base/RCTBridgeDelegate.h +++ b/packages/react-native/React/Base/RCTBridgeDelegate.h @@ -13,17 +13,6 @@ NS_ASSUME_NONNULL_BEGIN @protocol RCTBridgeDelegate -#ifndef RCT_REMOVE_LEGACY_ARCH - -/** - * The location of the JavaScript source file. When running from the packager - * this should be an absolute URL, e.g. `http://localhost:8081/index.ios.bundle`. - * When running from a locally bundled JS file, this should be a `file://` url - * pointing to a path inside the app resources, e.g. `file://.../main.jsbundle`. - */ -- (NSURL *__nullable)sourceURLForBridge:(RCTBridge *)bridge - __deprecated_msg("This API will be removed along with the legacy architecture."); -#endif @end NS_ASSUME_NONNULL_END diff --git a/packages/rn-tester/RNTester/SceneDelegate.mm b/packages/rn-tester/RNTester/SceneDelegate.mm index 26c4b217677f..bd9635151caa 100644 --- a/packages/rn-tester/RNTester/SceneDelegate.mm +++ b/packages/rn-tester/RNTester/SceneDelegate.mm @@ -89,11 +89,6 @@ - (void)scene:(UIScene *)scene continueUserActivity:(NSUserActivity *)userActivi [RCTLinkingManager scene:scene continueUserActivity:userActivity]; } -- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge -{ - return [self bundleURL]; -} - - (NSURL *)bundleURL { return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:kBundlePath]; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 1ca098e4b6f9..369407ed545c 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -2525,7 +2525,6 @@ protocol RCTBackedTextInputViewProtocol : public UITextInput { } protocol RCTBridgeDelegate : public NSObject { - public virtual NSURL* _Nullable sourceURLForBridge:(RCTBridge* bridge); } protocol RCTBridgeMethod : public NSObject { diff --git a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api index 4d74084f2445..1fd4521efc72 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api @@ -2583,7 +2583,6 @@ protocol RCTBackedTextInputViewProtocol : public UITextInput { } protocol RCTBridgeDelegate : public NSObject { - public virtual NSURL* _Nullable sourceURLForBridge:(RCTBridge* bridge); } protocol RCTBridgeMethod : public NSObject { diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index 1c4998b3d189..3db0e926dc1e 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -2525,7 +2525,6 @@ protocol RCTBackedTextInputViewProtocol : public UITextInput { } protocol RCTBridgeDelegate : public NSObject { - public virtual NSURL* _Nullable sourceURLForBridge:(RCTBridge* bridge); } protocol RCTBridgeMethod : public NSObject { From 07d800685149b7ebd9d337b2d5138033f544161e Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 27 Oct 2026 07:09:49 -0700 Subject: [PATCH 2/5] Delete dead bridge flag functions and module hooks Summary: Remove the always-on TurboModule flag functions, the unread accessibility-manager flag, the uncalled `batchDidComplete` hook, and the unused `RCTJavaScriptCallback` typedef. Deprecate the ignored `newArchEnabled:` configuration initializers, which external clients still call. Changelog: [iOS][Removed] - Remove dead `RCTBridge` flag functions, `batchDidComplete`, and unused callback typedef Differential Revision: D127294780 --- .../RCTDefaultReactNativeFactoryDelegate.mm | 5 ----- .../AppDelegate/RCTReactNativeFactory.mm | 2 +- .../AppDelegate/RCTRootViewFactory.h | 10 +++++++-- packages/react-native/React/Base/RCTBridge.h | 12 ----------- packages/react-native/React/Base/RCTBridge.mm | 21 ------------------- .../react-native/React/Base/RCTBridgeModule.h | 5 ----- .../React/Base/RCTJavaScriptExecutor.h | 2 -- .../React/CoreModules/RCTPerfMonitor.mm | 1 - .../platform/ios/ReactCommon/RCTTurboModule.h | 4 ---- .../api-snapshots/ReactAppleDebugCxx.api | 3 ++- .../api-snapshots/ReactAppleFrameworksCxx.api | 3 ++- .../api-snapshots/ReactAppleNewarchCxx.api | 3 ++- .../api-snapshots/ReactAppleReleaseCxx.api | 3 ++- 13 files changed, 17 insertions(+), 57 deletions(-) diff --git a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm index 68c66feb8de2..e72ceced8275 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm @@ -104,11 +104,6 @@ - (void)hostDidStart:(RCTHost *)host #pragma mark - RCTArchConfiguratorProtocol -- (BOOL)newArchEnabled -{ - return YES; -} - - (Class)getModuleClassFromName:(const char *)name { return nullptr; diff --git a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm index deba936037f4..f5d7e554e672 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm @@ -289,7 +289,7 @@ - (RCTRootViewFactory *)createRCTRootViewFactory }; RCTRootViewFactoryConfiguration *configuration = - [[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock newArchEnabled:YES]; + [[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock]; configuration.customizeRootView = ^(UIView *_Nonnull rootView) { [weakSelf.delegate customizeRootView:(RCTRootView *)rootView]; diff --git a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h index 14334a2c102e..e7af4bb09b6e 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h +++ b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h @@ -56,10 +56,16 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc * pointing to a path inside the app resources, e.g. `file://.../main.jsbundle`. * */ +- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock NS_DESIGNATED_INITIALIZER; + +- (instancetype)initWithBundleURL:(NSURL *)bundleURL; + - (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock - newArchEnabled:(BOOL)newArchEnabled NS_DESIGNATED_INITIALIZER; + newArchEnabled:(BOOL)newArchEnabled + __deprecated_msg("The flag is ignored; use initWithBundleURLBlock:."); -- (instancetype)initWithBundleURL:(NSURL *)bundleURL newArchEnabled:(BOOL)newArchEnabled; +- (instancetype)initWithBundleURL:(NSURL *)bundleURL + newArchEnabled:(BOOL)newArchEnabled __deprecated_msg("The flag is ignored; use initWithBundleURL:."); /** * Block that allows to override logic of creating root view instance. diff --git a/packages/react-native/React/Base/RCTBridge.h b/packages/react-native/React/Base/RCTBridge.h index 38894bea192b..d09cdeed3edd 100644 --- a/packages/react-native/React/Base/RCTBridge.h +++ b/packages/react-native/React/Base/RCTBridge.h @@ -43,15 +43,6 @@ NSString *RCTBridgeModuleNameForClass(Class bridgeModuleClass); */ NSMutableArray *getModulesLoadedWithOldArch(void); -/** - * The New Architecture is enabled by default. These APIs are no-ops and will - * be removed in a future release. - */ -BOOL RCTTurboModuleEnabled(void) - __attribute__((deprecated("TurboModules are always enabled; this always returns YES (NO in test env)."))); -void RCTEnableTurboModule(BOOL enabled) - __attribute__((deprecated("No-op. The New Architecture is enabled by default."))); - #ifndef RCT_REMOVE_LEGACY_MODULE_INTEROP // Turn on TurboModule interop BOOL RCTTurboModuleInteropEnabled(void); @@ -64,9 +55,6 @@ BOOL RCTFabricInteropLayerEnabled(void); void RCTEnableFabricInteropLayer(BOOL enabled); #endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP -BOOL RCTUIManagerDispatchAccessibilityManagerInitOntoMain(void); -void RCTUIManagerSetDispatchAccessibilityManagerInitOntoMain(BOOL enabled); - typedef enum { kRCTBridgeProxyLoggingLevelNone, kRCTBridgeProxyLoggingLevelWarning, diff --git a/packages/react-native/React/Base/RCTBridge.mm b/packages/react-native/React/Base/RCTBridge.mm index ec1c948ed964..9998204e136c 100644 --- a/packages/react-native/React/Base/RCTBridge.mm +++ b/packages/react-native/React/Base/RCTBridge.mm @@ -182,16 +182,6 @@ void RCTRegisterModule(Class moduleClass) return RCTDropReactPrefixes(name); } -BOOL RCTTurboModuleEnabled(void) -{ - return YES; -} - -void RCTEnableTurboModule(BOOL enabled) -{ - // The new Architecture is enabled by default and we are ignoring changes to the TurboModule system. -} - #ifndef RCT_REMOVE_LEGACY_MODULE_INTEROP static BOOL turboModuleInteropEnabled = NO; BOOL RCTTurboModuleInteropEnabled(void) @@ -228,17 +218,6 @@ void RCTSetTurboModuleInteropBridgeProxyLogLevel(RCTBridgeProxyLoggingLevel logL bridgeProxyLoggingLevel = logLevel; } -BOOL kDispatchAccessibilityManagerInitOntoMain = NO; -BOOL RCTUIManagerDispatchAccessibilityManagerInitOntoMain(void) -{ - return kDispatchAccessibilityManagerInitOntoMain; -} - -void RCTUIManagerSetDispatchAccessibilityManagerInitOntoMain(BOOL enabled) -{ - kDispatchAccessibilityManagerInitOntoMain = enabled; -} - @implementation RCTBridge - (instancetype)initWithDelegate:(id)delegate launchOptions:(NSDictionary *)launchOptions { diff --git a/packages/react-native/React/Base/RCTBridgeModule.h b/packages/react-native/React/Base/RCTBridgeModule.h index 005e10d84f69..3f52bbb17a3d 100644 --- a/packages/react-native/React/Base/RCTBridgeModule.h +++ b/packages/react-native/React/Base/RCTBridgeModule.h @@ -402,11 +402,6 @@ RCT_EXTERN_C_END */ - (NSDictionary *)constantsToExport; -/** - * Notifies the module that a batch of JS method invocations has just completed. - */ -- (void)batchDidComplete RCT_DEPRECATED; - @end /** diff --git a/packages/react-native/React/Base/RCTJavaScriptExecutor.h b/packages/react-native/React/Base/RCTJavaScriptExecutor.h index 965d78e7361c..2fdbe3079dbc 100644 --- a/packages/react-native/React/Base/RCTJavaScriptExecutor.h +++ b/packages/react-native/React/Base/RCTJavaScriptExecutor.h @@ -12,5 +12,3 @@ typedef void (^RCTJavaScriptCompleteBlock)(NSError *__strong) __deprecated_msg("This api will be removed along with the bridge."); -typedef void (^RCTJavaScriptCallback)(__strong id, NSError *__strong) - __deprecated_msg("This api will be removed along with the bridge."); diff --git a/packages/react-native/React/CoreModules/RCTPerfMonitor.mm b/packages/react-native/React/CoreModules/RCTPerfMonitor.mm index 2bb27c1eaebf..9a7c4a9d362a 100644 --- a/packages/react-native/React/CoreModules/RCTPerfMonitor.mm +++ b/packages/react-native/React/CoreModules/RCTPerfMonitor.mm @@ -22,7 +22,6 @@ #import #import #import -#import #import #import #import diff --git a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.h b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.h index d26d4f247ba7..2e37b5782360 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.h +++ b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.h @@ -22,10 +22,6 @@ #import #import -#define RCT_IS_TURBO_MODULE_CLASS(klass) \ - ((RCTTurboModuleEnabled() && [(klass) conformsToProtocol:@protocol(RCTTurboModule)])) -#define RCT_IS_TURBO_MODULE_INSTANCE(module) RCT_IS_TURBO_MODULE_CLASS([(module) class]) - namespace facebook::react { class CallbackWrapper; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 369407ed545c..2212c440c6d8 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -1611,7 +1611,9 @@ interface RCTRootViewFactoryConfiguration : public NSObject { public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress; public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge; public @property (weak) id jsRuntimeConfiguratorDelegate; + public virtual instancetype initWithBundleURL:(NSURL* bundleURL); public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled); + public virtual instancetype initWithBundleURLBlock:(RCTBundleURLBlock bundleURLBlock); public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled); } @@ -2545,7 +2547,6 @@ protocol RCTBridgeModule : public NSObject { public virtual _Nullable NSArray>* methodsToExport(); public virtual static BOOL requiresMainQueueSetup(); public virtual static NSString* moduleName(); - public virtual void batchDidComplete(); } protocol RCTCallInvokerModule : public NSObject { diff --git a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api index 1fd4521efc72..4f896cf2490f 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api @@ -1654,7 +1654,9 @@ interface RCTRootViewFactoryConfiguration : public NSObject { public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress; public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge; public @property (weak) id jsRuntimeConfiguratorDelegate; + public virtual instancetype initWithBundleURL:(NSURL* bundleURL); public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled); + public virtual instancetype initWithBundleURLBlock:(RCTBundleURLBlock bundleURLBlock); public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled); } @@ -2603,7 +2605,6 @@ protocol RCTBridgeModule : public NSObject { public virtual _Nullable NSArray>* methodsToExport(); public virtual static BOOL requiresMainQueueSetup(); public virtual static NSString* moduleName(); - public virtual void batchDidComplete(); } protocol RCTCallInvokerModule : public NSObject { diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index df4b2417b5af..eaed2984f237 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -1610,7 +1610,9 @@ interface RCTRootViewFactoryConfiguration : public NSObject { public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress; public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge; public @property (weak) id jsRuntimeConfiguratorDelegate; + public virtual instancetype initWithBundleURL:(NSURL* bundleURL); public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled); + public virtual instancetype initWithBundleURLBlock:(RCTBundleURLBlock bundleURLBlock); public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled); } @@ -2538,7 +2540,6 @@ protocol RCTBridgeModule : public NSObject { public virtual _Nullable NSArray>* methodsToExport(); public virtual static BOOL requiresMainQueueSetup(); public virtual static NSString* moduleName(); - public virtual void batchDidComplete(); } protocol RCTCallInvokerModule : public NSObject { diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index 3db0e926dc1e..5cbc9e3de06c 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -1611,7 +1611,9 @@ interface RCTRootViewFactoryConfiguration : public NSObject { public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress; public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge; public @property (weak) id jsRuntimeConfiguratorDelegate; + public virtual instancetype initWithBundleURL:(NSURL* bundleURL); public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled); + public virtual instancetype initWithBundleURLBlock:(RCTBundleURLBlock bundleURLBlock); public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled); } @@ -2545,7 +2547,6 @@ protocol RCTBridgeModule : public NSObject { public virtual _Nullable NSArray>* methodsToExport(); public virtual static BOOL requiresMainQueueSetup(); public virtual static NSString* moduleName(); - public virtual void batchDidComplete(); } protocol RCTCallInvokerModule : public NSObject { From 9140ffb7a28f0886fa78de56b03e508e9f21c00c Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 27 Oct 2026 07:09:50 -0700 Subject: [PATCH 3/5] Delete dead RCTCxxBridgeDelegate protocol Summary: The C++ bridge delegate protocol has no implementers left: its only method served the removed `RCTCxxBridge`. Delete the header with its build entry, the stale forward declaration, and the unused imports. Changelog: [iOS][Removed] - Remove unused `RCTCxxBridgeDelegate` protocol Differential Revision: D127294781 --- .../AppDelegate/RCTRootViewFactory.h | 1 - .../React/CxxBridge/RCTCxxBridgeDelegate.h | 31 ------------------- .../api-snapshots/ReactAppleDebugCxx.api | 4 --- .../api-snapshots/ReactAppleFrameworksCxx.api | 4 --- .../api-snapshots/ReactAppleNewarchCxx.api | 4 --- .../api-snapshots/ReactAppleReleaseCxx.api | 4 --- 6 files changed, 48 deletions(-) delete mode 100644 packages/react-native/React/CxxBridge/RCTCxxBridgeDelegate.h diff --git a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h index e7af4bb09b6e..53ade7d6fef2 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h +++ b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h @@ -11,7 +11,6 @@ #import #import "RCTJSRuntimeConfiguratorProtocol.h" -@protocol RCTCxxBridgeDelegate; @protocol RCTComponentViewFactoryComponentProvider; @protocol RCTTurboModuleManagerDelegate; @protocol RCTHostDelegate; diff --git a/packages/react-native/React/CxxBridge/RCTCxxBridgeDelegate.h b/packages/react-native/React/CxxBridge/RCTCxxBridgeDelegate.h deleted file mode 100644 index e2d48db4548d..000000000000 --- a/packages/react-native/React/CxxBridge/RCTCxxBridgeDelegate.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#import - -namespace facebook::react { - -class JSExecutorFactory; - -} // namespace facebook::react - -// This is a separate class so non-C++ implementations don't need to -// take a C++ dependency. - -@protocol RCTCxxBridgeDelegate - -/** - * In the RCTCxxBridge, if this method is implemented, return a - * ExecutorFactory instance which can be used to create the executor. - * If not implemented, or returns an empty pointer, JSIExecutorFactory - * will be used with a JSCRuntime. - */ -- (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge; - -@end diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 2212c440c6d8..3606ce017e10 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -2597,10 +2597,6 @@ protocol RCTCustomRefreshControlProtocol { public @property (weak) UIScrollView* scrollView; } -protocol RCTCxxBridgeDelegate : public RCTBridgeDelegate { - public virtual std::unique_ptr jsExecutorFactoryForBridge:(RCTBridge* bridge); -} - protocol RCTDebuggingOverlayViewProtocol : public NSObject { public virtual void clearElementsHighlights(); public virtual void highlightElements:(const NSArray* elements); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api index 4f896cf2490f..adcc2ee97c11 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api @@ -2659,10 +2659,6 @@ protocol RCTCustomRefreshControlProtocol { public @property (weak) UIScrollView* scrollView; } -protocol RCTCxxBridgeDelegate : public RCTBridgeDelegate { - public virtual std::unique_ptr jsExecutorFactoryForBridge:(RCTBridge* bridge); -} - protocol RCTDebuggingOverlayViewProtocol : public NSObject { public virtual void clearElementsHighlights(); public virtual void highlightElements:(const NSArray* elements); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index eaed2984f237..df13348a5514 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -2590,10 +2590,6 @@ protocol RCTCustomRefreshControlProtocol { public @property (weak) UIScrollView* scrollView; } -protocol RCTCxxBridgeDelegate : public RCTBridgeDelegate { - public virtual std::unique_ptr jsExecutorFactoryForBridge:(RCTBridge* bridge); -} - protocol RCTDebuggingOverlayViewProtocol : public NSObject { public virtual void clearElementsHighlights(); public virtual void highlightElements:(const NSArray* elements); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index 5cbc9e3de06c..f635376e9c28 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -2597,10 +2597,6 @@ protocol RCTCustomRefreshControlProtocol { public @property (weak) UIScrollView* scrollView; } -protocol RCTCxxBridgeDelegate : public RCTBridgeDelegate { - public virtual std::unique_ptr jsExecutorFactoryForBridge:(RCTBridge* bridge); -} - protocol RCTDebuggingOverlayViewProtocol : public NSObject { public virtual void clearElementsHighlights(); public virtual void highlightElements:(const NSArray* elements); From 139bec0c86339a04dd0b0387fdb536e27c4f2509 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 27 Oct 2026 07:11:39 -0700 Subject: [PATCH 4/5] Delete dead per-module RCTBridge accessors Summary: Five module accessors on `RCTBridge` (`networking`, `webSocketModule`, `accessibilityManager`, `devSettings`, `imageStoreManager`) have no callers. Delete the bridge-side declarations and the last bridge-side implementation (`uiManager`, whose proxy implementation stays). Deprecate `devMenu`, which external clients still use. Changelog: [iOS][Removed] - Remove unused per-module `RCTBridge` accessors Differential Revision: D127294783 --- .../Libraries/Image/RCTImageStoreManager.h | 6 ------ .../Libraries/Network/RCTNetworking.h | 6 ------ .../CoreModules/RCTAccessibilityManager.h | 6 ------ .../React/CoreModules/RCTDevMenu.h | 3 ++- .../React/CoreModules/RCTDevSettings.h | 6 ------ .../React/CoreModules/RCTWebSocketModule.h | 6 ------ .../React/Modules/RCTUIManager.mm | 9 --------- .../api-snapshots/ReactAppleDebugCxx.api | 20 ------------------- .../api-snapshots/ReactAppleFrameworksCxx.api | 20 ------------------- .../api-snapshots/ReactAppleNewarchCxx.api | 20 ------------------- .../api-snapshots/ReactAppleReleaseCxx.api | 20 ------------------- 11 files changed, 2 insertions(+), 120 deletions(-) diff --git a/packages/react-native/Libraries/Image/RCTImageStoreManager.h b/packages/react-native/Libraries/Image/RCTImageStoreManager.h index 61f324d51cd4..87cd99a3ed61 100644 --- a/packages/react-native/Libraries/Image/RCTImageStoreManager.h +++ b/packages/react-native/Libraries/Image/RCTImageStoreManager.h @@ -40,12 +40,6 @@ @end -@interface RCTBridge (RCTImageStoreManager) - -@property (nonatomic, readonly) RCTImageStoreManager *imageStoreManager; - -@end - @interface RCTBridgeProxy (RCTImageStoreManager) @property (nonatomic, readonly) RCTImageStoreManager *imageStoreManager; diff --git a/packages/react-native/Libraries/Network/RCTNetworking.h b/packages/react-native/Libraries/Network/RCTNetworking.h index 430c94f582e7..f6e1313296b6 100644 --- a/packages/react-native/Libraries/Network/RCTNetworking.h +++ b/packages/react-native/Libraries/Network/RCTNetworking.h @@ -61,12 +61,6 @@ @end -@interface RCTBridge (RCTNetworking) - -@property (nonatomic, readonly) RCTNetworking *networking; - -@end - @interface RCTBridgeProxy (RCTNetworking) @property (nonatomic, readonly) RCTNetworking *networking; diff --git a/packages/react-native/React/CoreModules/RCTAccessibilityManager.h b/packages/react-native/React/CoreModules/RCTAccessibilityManager.h index e2063e67c885..734b5fd39ced 100644 --- a/packages/react-native/React/CoreModules/RCTAccessibilityManager.h +++ b/packages/react-native/React/CoreModules/RCTAccessibilityManager.h @@ -32,12 +32,6 @@ extern NSString *const RCTAccessibilityManagerDidUpdateMultiplierNotification; / @end -@interface RCTBridge (RCTAccessibilityManager) - -@property (nonatomic, readonly) RCTAccessibilityManager *accessibilityManager; - -@end - @interface RCTBridgeProxy (RCTAccessibilityManager) @property (nonatomic, readonly) RCTAccessibilityManager *accessibilityManager; diff --git a/packages/react-native/React/CoreModules/RCTDevMenu.h b/packages/react-native/React/CoreModules/RCTDevMenu.h index 976cb8c517b5..ab6132f0a442 100644 --- a/packages/react-native/React/CoreModules/RCTDevMenu.h +++ b/packages/react-native/React/CoreModules/RCTDevMenu.h @@ -137,7 +137,8 @@ typedef NSString * (^RCTDevMenuItemTitleBlock)(void); */ @interface RCTBridge (RCTDevMenu) -@property (nonatomic, readonly) RCTDevMenu *devMenu; +@property (nonatomic, readonly) RCTDevMenu *devMenu __deprecated_msg( + "Access RCTDevMenu through the bridge proxy instead; this accessor will be removed."); @end diff --git a/packages/react-native/React/CoreModules/RCTDevSettings.h b/packages/react-native/React/CoreModules/RCTDevSettings.h index cffe380b9355..421b3d252948 100644 --- a/packages/react-native/React/CoreModules/RCTDevSettings.h +++ b/packages/react-native/React/CoreModules/RCTDevSettings.h @@ -142,12 +142,6 @@ typedef void (^RCTConnectedHandler)(void); @end -@interface RCTBridge (RCTDevSettings) - -@property (nonatomic, readonly) RCTDevSettings *devSettings; - -@end - @interface RCTBridgeProxy (RCTDevSettings) @property (nonatomic, readonly) RCTDevSettings *devSettings; diff --git a/packages/react-native/React/CoreModules/RCTWebSocketModule.h b/packages/react-native/React/CoreModules/RCTWebSocketModule.h index 0deba70671ff..c0e240f10020 100644 --- a/packages/react-native/React/CoreModules/RCTWebSocketModule.h +++ b/packages/react-native/React/CoreModules/RCTWebSocketModule.h @@ -33,12 +33,6 @@ RCT_EXTERN void RCTSetCustomSRWebSocketProvider(SRWebSocketProvider provider); @end -@interface RCTBridge (RCTWebSocketModule) - -- (RCTWebSocketModule *)webSocketModule; - -@end - @interface RCTBridgeProxy (RCTWebSocketModule) - (RCTWebSocketModule *)webSocketModule; diff --git a/packages/react-native/React/Modules/RCTUIManager.mm b/packages/react-native/React/Modules/RCTUIManager.mm index 1ab3804b0398..6bacf3f711d4 100644 --- a/packages/react-native/React/Modules/RCTUIManager.mm +++ b/packages/react-native/React/Modules/RCTUIManager.mm @@ -220,15 +220,6 @@ - (void)invalidate @end -@implementation RCTBridge (RCTUIManager) - -- (RCTUIManager *)uiManager -{ - return [self moduleForClass:[RCTUIManager class]]; -} - -@end - UIView *RCTPaperViewOrCurrentView(UIView *view) { if ([view respondsToSelector:@selector(paperView)]) { diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 3606ce017e10..4a6c5f86fa02 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -10,18 +10,10 @@ category RCTBridge(Inspector) { public @property (assign, readonly) facebook::react::jsinspector_modern::HostTarget* inspectorTarget; } -category RCTBridge(RCTAccessibilityManager) { - public @property (assign, readonly) RCTAccessibilityManager* accessibilityManager; -} - category RCTBridge(RCTDevMenu) { public @property (assign, readonly) RCTDevMenu* devMenu; } -category RCTBridge(RCTDevSettings) { - public @property (assign, readonly) RCTDevSettings* devSettings; -} - category RCTBridge(RCTEventDispatcher) { public virtual id eventDispatcher(); } @@ -30,14 +22,6 @@ category RCTBridge(RCTImageLoader) { public @property (assign, readonly) RCTImageLoader* imageLoader; } -category RCTBridge(RCTImageStoreManager) { - public @property (assign, readonly) RCTImageStoreManager* imageStoreManager; -} - -category RCTBridge(RCTNetworking) { - public @property (assign, readonly) RCTNetworking* networking; -} - category RCTBridge(RCTSurfacePresenterStub) { public virtual id surfacePresenter(); public virtual void setSurfacePresenter:(id presenter); @@ -47,10 +31,6 @@ category RCTBridge(RCTUIManager) { public @property (assign, readonly) RCTUIManager* uiManager; } -category RCTBridge(RCTWebSocketModule) { - public virtual RCTWebSocketModule* webSocketModule(); -} - category RCTBridgeProxy(Cxx) { public @property (assign) std::shared_ptr jsCallInvoker; } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api index adcc2ee97c11..e5c80b39b4bf 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api @@ -10,18 +10,10 @@ category RCTBridge(Inspector) { public @property (assign, readonly) facebook::react::jsinspector_modern::HostTarget* inspectorTarget; } -category RCTBridge(RCTAccessibilityManager) { - public @property (assign, readonly) RCTAccessibilityManager* accessibilityManager; -} - category RCTBridge(RCTDevMenu) { public @property (assign, readonly) RCTDevMenu* devMenu; } -category RCTBridge(RCTDevSettings) { - public @property (assign, readonly) RCTDevSettings* devSettings; -} - category RCTBridge(RCTEventDispatcher) { public virtual id eventDispatcher(); } @@ -30,14 +22,6 @@ category RCTBridge(RCTImageLoader) { public @property (assign, readonly) RCTImageLoader* imageLoader; } -category RCTBridge(RCTImageStoreManager) { - public @property (assign, readonly) RCTImageStoreManager* imageStoreManager; -} - -category RCTBridge(RCTNetworking) { - public @property (assign, readonly) RCTNetworking* networking; -} - category RCTBridge(RCTSurfacePresenterStub) { public virtual id surfacePresenter(); public virtual void setSurfacePresenter:(id presenter); @@ -47,10 +31,6 @@ category RCTBridge(RCTUIManager) { public @property (assign, readonly) RCTUIManager* uiManager; } -category RCTBridge(RCTWebSocketModule) { - public virtual RCTWebSocketModule* webSocketModule(); -} - category RCTBridgeProxy(Cxx) { public @property (assign) std::shared_ptr jsCallInvoker; } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index df13348a5514..a829d072a94a 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -10,18 +10,10 @@ category RCTBridge(Inspector) { public @property (assign, readonly) facebook::react::jsinspector_modern::HostTarget* inspectorTarget; } -category RCTBridge(RCTAccessibilityManager) { - public @property (assign, readonly) RCTAccessibilityManager* accessibilityManager; -} - category RCTBridge(RCTDevMenu) { public @property (assign, readonly) RCTDevMenu* devMenu; } -category RCTBridge(RCTDevSettings) { - public @property (assign, readonly) RCTDevSettings* devSettings; -} - category RCTBridge(RCTEventDispatcher) { public virtual id eventDispatcher(); } @@ -30,14 +22,6 @@ category RCTBridge(RCTImageLoader) { public @property (assign, readonly) RCTImageLoader* imageLoader; } -category RCTBridge(RCTImageStoreManager) { - public @property (assign, readonly) RCTImageStoreManager* imageStoreManager; -} - -category RCTBridge(RCTNetworking) { - public @property (assign, readonly) RCTNetworking* networking; -} - category RCTBridge(RCTSurfacePresenterStub) { public virtual id surfacePresenter(); public virtual void setSurfacePresenter:(id presenter); @@ -47,10 +31,6 @@ category RCTBridge(RCTUIManager) { public @property (assign, readonly) RCTUIManager* uiManager; } -category RCTBridge(RCTWebSocketModule) { - public virtual RCTWebSocketModule* webSocketModule(); -} - category RCTBridgeProxy(Cxx) { public @property (assign) std::shared_ptr jsCallInvoker; } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index f635376e9c28..8c9740672cdf 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -10,18 +10,10 @@ category RCTBridge(Inspector) { public @property (assign, readonly) facebook::react::jsinspector_modern::HostTarget* inspectorTarget; } -category RCTBridge(RCTAccessibilityManager) { - public @property (assign, readonly) RCTAccessibilityManager* accessibilityManager; -} - category RCTBridge(RCTDevMenu) { public @property (assign, readonly) RCTDevMenu* devMenu; } -category RCTBridge(RCTDevSettings) { - public @property (assign, readonly) RCTDevSettings* devSettings; -} - category RCTBridge(RCTEventDispatcher) { public virtual id eventDispatcher(); } @@ -30,14 +22,6 @@ category RCTBridge(RCTImageLoader) { public @property (assign, readonly) RCTImageLoader* imageLoader; } -category RCTBridge(RCTImageStoreManager) { - public @property (assign, readonly) RCTImageStoreManager* imageStoreManager; -} - -category RCTBridge(RCTNetworking) { - public @property (assign, readonly) RCTNetworking* networking; -} - category RCTBridge(RCTSurfacePresenterStub) { public virtual id surfacePresenter(); public virtual void setSurfacePresenter:(id presenter); @@ -47,10 +31,6 @@ category RCTBridge(RCTUIManager) { public @property (assign, readonly) RCTUIManager* uiManager; } -category RCTBridge(RCTWebSocketModule) { - public virtual RCTWebSocketModule* webSocketModule(); -} - category RCTBridgeProxy(Cxx) { public @property (assign) std::shared_ptr jsCallInvoker; } From 1ebe27d3b2530d92ad9047eca58b3b62332c03ec Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 27 Oct 2026 07:16:49 -0700 Subject: [PATCH 5/5] Delete dead RCTBridge public API and skipped logging tests (#59429) Summary: Pull Request resolved: https://github.com/react/react-native/pull/59429 Remove `RCTBridge` declarations with zero callers: `enqueueJSCall`, module lookup, `delegate`, `moduleClasses`, reload, and batch APIs, plus their stub implementations. Keep `bundleURL`, still read by Expo Dev Menu, and the TurboModule-registry hooks the proxy forwards through, all marked deprecated. Delete skipped `RCTLoggingTests`, the only `enqueueJSCall` caller. Changelog: [iOS][Removed] - Remove unused `RCTBridge` reload, module-lookup, and JS-callback APIs [iOS][Deprecated] - Deprecate `RCTBridge.bundleURL`, `setRCTTurboModuleRegistry:`, and `bridgeModuleDecorator` Differential Revision: D127265582 --- packages/react-native/React/Base/RCTBridge.h | 64 +------- packages/react-native/React/Base/RCTBridge.mm | 38 ----- .../RCTLoggingTests.m | 146 ------------------ .../api-snapshots/ReactAppleDebugCxx.api | 10 -- .../api-snapshots/ReactAppleFrameworksCxx.api | 10 -- .../api-snapshots/ReactAppleNewarchCxx.api | 10 -- .../api-snapshots/ReactAppleReleaseCxx.api | 10 -- 7 files changed, 6 insertions(+), 282 deletions(-) delete mode 100644 packages/rn-tester/RNTesterIntegrationTests/RCTLoggingTests.m diff --git a/packages/react-native/React/Base/RCTBridge.h b/packages/react-native/React/Base/RCTBridge.h index d09cdeed3edd..a161887ca87a 100644 --- a/packages/react-native/React/Base/RCTBridge.h +++ b/packages/react-native/React/Base/RCTBridge.h @@ -112,17 +112,6 @@ RCT_EXTERN_C_END launchOptions:(NSDictionary *)launchOptions __deprecated_msg("This API will be removed along with the legacy architecture."); -/** - * This method is used to call functions in the JavaScript application context. - * It is primarily intended for use by modules that require two-way communication - * with the JavaScript code. Safe to call from any thread. - */ -- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args; -- (void)enqueueJSCall:(NSString *)module - method:(NSString *)method - args:(NSArray *)args - completion:(dispatch_block_t)completion; - /** * This method registers the file path of an additional JS segment by its ID. * @@ -147,38 +136,22 @@ RCT_EXTERN_C_END * When a NativeModule performs a lookup for a TurboModule, we need to query * the TurboModuleRegistry. */ -- (void)setRCTTurboModuleRegistry:(id)turboModuleRegistry; +- (void)setRCTTurboModuleRegistry:(id)turboModuleRegistry + __deprecated_msg("This API will be removed along with the legacy architecture."); /** * This hook is called by the TurboModule infra with every ObjC module that's created. * It allows the bridge to attach properties to ObjC modules that give those modules * access to Bridge APIs. */ -- (RCTBridgeModuleDecorator *)bridgeModuleDecorator; - -/** - * Convenience method for retrieving all modules conforming to a given protocol. - * Modules will be synchronously instantiated if they haven't already been, - * potentially blocking both the calling thread and main thread for a short time. - */ -- (NSArray *)modulesConformingToProtocol:(Protocol *)protocol; - -/** - * Test if a module has been initialized. Use this prior to calling - * `moduleForClass:` or `moduleForName:` if you do not want to cause the module - * to be instantiated if it hasn't been already. - */ -- (BOOL)moduleIsInitialized:(Class)moduleClass; - -/** - * All registered bridge module classes. - */ -@property (nonatomic, copy, readonly) NSArray *moduleClasses; +- (RCTBridgeModuleDecorator *) + bridgeModuleDecorator __deprecated_msg("This API will be removed along with the legacy architecture."); /** * URL of the script that was loaded into the bridge. */ -@property (nonatomic, strong, readonly) NSURL *bundleURL; +@property (nonatomic, strong, readonly) + NSURL *bundleURL __deprecated_msg("This API will be removed along with the legacy architecture."); /** * The class of the executor currently being used. Changes to this value will @@ -186,11 +159,6 @@ RCT_EXTERN_C_END */ @property (nonatomic, strong) Class executorClass; -/** - * The delegate provided during the bridge initialization - */ -@property (nonatomic, weak, readonly) id delegate; - /** * The launch options that were used to initialize the bridge. */ @@ -211,29 +179,9 @@ RCT_EXTERN_C_END */ @property (nonatomic, readonly, strong) RCTPerformanceLogger *performanceLogger; -/** - * Reload the bundle and reset executor & modules. Safe to call from any thread. - */ -- (void)reload __deprecated_msg("Use RCTReloadCommand instead"); - -/** - * Reload the bundle and reset executor & modules. Safe to call from any thread. - */ -- (void)reloadWithReason:(NSString *)reason __deprecated_msg("Use RCTReloadCommand instead"); - /** * Handle notifications for a fast refresh. Safe to call from any thread. */ - (void)onFastRefresh; -/** - * Inform the bridge, and anything subscribing to it, that it should reload. - */ -- (void)requestReload __deprecated_msg("Use RCTReloadCommand instead"); - -/** - * Says whether bridge has started receiving calls from JavaScript. - */ -- (BOOL)isBatchActive; - @end diff --git a/packages/react-native/React/Base/RCTBridge.mm b/packages/react-native/React/Base/RCTBridge.mm index 9998204e136c..93d5bd2344d0 100644 --- a/packages/react-native/React/Base/RCTBridge.mm +++ b/packages/react-native/React/Base/RCTBridge.mm @@ -231,17 +231,6 @@ - (instancetype)initWithBundleURL:(NSURL *)bundleURL return self; } -- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args -{ -} - -- (void)enqueueJSCall:(NSString *)module - method:(NSString *)method - args:(NSArray *)args - completion:(__strong dispatch_block_t)completion -{ -} - - (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path { } @@ -270,37 +259,10 @@ - (RCTBridgeModuleDecorator *)bridgeModuleDecorator return nil; } -- (NSArray *)modulesConformingToProtocol:(Protocol *)protocol -{ - return @[]; -} - -- (BOOL)moduleIsInitialized:(Class)moduleClass -{ - return NO; -} - -- (void)reload __attribute__((deprecated("Use RCTReloadCommand instead"))) -{ -} - -- (void)reloadWithReason:(NSString *)reason __attribute__((deprecated("Use RCTReloadCommand instead"))) -{ -} - - (void)onFastRefresh { } -- (void)requestReload __attribute__((deprecated("Use RCTReloadCommand instead"))) -{ -} - -- (BOOL)isBatchActive -{ - return NO; -} - - (void)enqueueCallback:(NSNumber *)cbID args:(NSArray *)args { } diff --git a/packages/rn-tester/RNTesterIntegrationTests/RCTLoggingTests.m b/packages/rn-tester/RNTesterIntegrationTests/RCTLoggingTests.m deleted file mode 100644 index dd2336c0c220..000000000000 --- a/packages/rn-tester/RNTesterIntegrationTests/RCTLoggingTests.m +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import -#import - -// Time to wait for an expected log statement to show before failing the test -const int64_t LOGGER_TIMEOUT = 10 * NSEC_PER_SEC; - -@interface RCTLoggingTests : XCTestCase - -@end - -@implementation RCTLoggingTests { - RCTBridge *_bridge; - - dispatch_semaphore_t _logSem; - RCTLogLevel _lastLogLevel; - RCTLogSource _lastLogSource; - NSString *_lastLogMessage; -} - -- (void)setUp -{ - XCTSkip(@"Skipping RCTLoggingTests since they rely on deprecated RCTBridge functionality."); - - NSURL *scriptURL; - if (getenv("CI_USE_PACKAGER")) { - NSString *app = @"IntegrationTests/IntegrationTestsApp"; - scriptURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@.bundle?platform=%@&dev=true", - app, - RCTPlatformName]]; - } else { - scriptURL = [[NSBundle bundleForClass:[RCTBridge class]] URLForResource:@"main" withExtension:@"jsbundle"]; - } - RCTAssert(scriptURL != nil, @"No scriptURL set"); - - _bridge = [[RCTBridge alloc] initWithBundleURL:scriptURL moduleProvider:NULL launchOptions:nil]; - NSDate *date = [NSDate dateWithTimeIntervalSinceNow:60]; - while (date.timeIntervalSinceNow > 0 && _bridge.loading) { - [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - } - XCTAssertFalse(_bridge.loading); - - _logSem = dispatch_semaphore_create(0); - - // Set the log function to signal the semaphore - RCTSetLogFunction( - ^(RCTLogLevel level, - RCTLogSource source, - __unused NSString *fileName, - __unused NSNumber *lineNumber, - NSString *message) { - if (source == RCTLogSourceJavaScript) { - self->_lastLogLevel = level; - self->_lastLogSource = source; - self->_lastLogMessage = message; - dispatch_semaphore_signal(self->_logSem); - } - }); -} - -- (void)tearDown -{ - [_bridge invalidate]; - _bridge = nil; - - RCTSetLogFunction(RCTDefaultLogFunction); -} - -- (void)testLogging -{ - intptr_t waitRet = 0; - - // First queue the marker and spin until it happens to be logged. - // This is to ensure we skip all of the other messages, that were logged earlier. - NSString *const LogMarker = @"===LOG_MARKER==="; - [_bridge enqueueJSCall:@"LoggingTestModule.logToConsole" args:@[ LogMarker ]]; - - do { - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for log marker"); - } while (waitRet == 0 && ![_lastLogMessage isEqualToString:LogMarker]); - - [_bridge enqueueJSCall:@"LoggingTestModule.logToConsole" args:@[ @"Invoking console.log" ]]; - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for logToConsole"); - - XCTAssertEqual(_lastLogLevel, RCTLogLevelInfo); - XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); - XCTAssertEqualObjects(_lastLogMessage, @"Invoking console.log"); - - [_bridge enqueueJSCall:@"LoggingTestModule.warning" args:@[ @"Generating warning" ]]; - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for warning"); - - XCTAssertEqual(_lastLogLevel, RCTLogLevelWarning); - XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); - XCTAssertEqualObjects(_lastLogMessage, @"Generating warning"); - - [_bridge enqueueJSCall:@"LoggingTestModule.invariant" args:@[ @"Invariant failed" ]]; - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for invariant"); - - XCTAssertEqual(_lastLogLevel, RCTLogLevelError); - XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); - XCTAssertTrue([_lastLogMessage containsString:@"Invariant Violation: Invariant failed"]); - - [_bridge enqueueJSCall:@"LoggingTestModule.logErrorToConsole" args:@[ @"Invoking console.error" ]]; - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for logErrorToConsole"); - - // For local bundles, we may first get a warning about symbolication - if (![_lastLogMessage isEqualToString:@"Invoking console.error"]) { - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for logErrorToConsole #2"); - } - - XCTAssertEqual(_lastLogLevel, RCTLogLevelError); - XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); - XCTAssertEqualObjects(_lastLogMessage, @"Invoking console.error"); - - [_bridge enqueueJSCall:@"LoggingTestModule.throwError" args:@[ @"Throwing an error" ]]; - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for throwError"); - - // For local bundles, we may first get a warning about symbolication - if (![_lastLogMessage containsString:@"Error: Throwing an error"]) { - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for throwError #2"); - } - - XCTAssertEqual(_lastLogLevel, RCTLogLevelError); - XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); - XCTAssertTrue([_lastLogMessage containsString:@"Error: Throwing an error"]); -} - -@end diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 4a6c5f86fa02..cf5e258bd17c 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -652,28 +652,18 @@ interface RCTBlobManager : public NSObject { public @property (assign, readonly) BOOL loading; public @property (assign, readonly) BOOL valid; - public @property (copy, readonly) NSArray* moduleClasses; public @property (copy, readonly) NSDictionary* launchOptions; public @property (strong) Class executorClass; public @property (strong, readonly) NSURL* bundleURL; public @property (strong, readonly) RCTPerformanceLogger* performanceLogger; - public @property (weak, readonly) id delegate; - public virtual BOOL isBatchActive(); - public virtual BOOL moduleIsInitialized:(Class moduleClass); - public virtual NSArray* modulesConformingToProtocol:(Protocol* protocol); public virtual RCTBridgeModuleDecorator* bridgeModuleDecorator(); public virtual id moduleForClass:(Class moduleClass); public virtual id moduleForName:(NSString* moduleName); public virtual id moduleForName:lazilyLoadIfNecessary:(NSString* moduleName, BOOL lazilyLoad); public virtual instancetype initWithBundleURL:moduleProvider:launchOptions:(NSURL* bundleURL, RCTBridgeModuleListProvider block, NSDictionary* launchOptions); public virtual instancetype initWithDelegate:launchOptions:(id delegate, NSDictionary* launchOptions); - public virtual void enqueueJSCall:args:(NSString* moduleDotMethod, NSArray* args); - public virtual void enqueueJSCall:method:args:completion:(NSString* module, NSString* method, NSArray* args, dispatch_block_t completion); public virtual void onFastRefresh(); public virtual void registerSegmentWithId:path:(NSUInteger segmentId, NSString* path); - public virtual void reload(); - public virtual void reloadWithReason:(NSString* reason); - public virtual void requestReload(); public virtual void setRCTTurboModuleRegistry:(id turboModuleRegistry); } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api index e5c80b39b4bf..0e9dcb2263cf 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api @@ -661,28 +661,18 @@ interface RCTBlobManager : public NSObject { public @property (assign, readonly) BOOL loading; public @property (assign, readonly) BOOL valid; - public @property (copy, readonly) NSArray* moduleClasses; public @property (copy, readonly) NSDictionary* launchOptions; public @property (strong) Class executorClass; public @property (strong, readonly) NSURL* bundleURL; public @property (strong, readonly) RCTPerformanceLogger* performanceLogger; - public @property (weak, readonly) id delegate; - public virtual BOOL isBatchActive(); - public virtual BOOL moduleIsInitialized:(Class moduleClass); - public virtual NSArray* modulesConformingToProtocol:(Protocol* protocol); public virtual RCTBridgeModuleDecorator* bridgeModuleDecorator(); public virtual id moduleForClass:(Class moduleClass); public virtual id moduleForName:(NSString* moduleName); public virtual id moduleForName:lazilyLoadIfNecessary:(NSString* moduleName, BOOL lazilyLoad); public virtual instancetype initWithBundleURL:moduleProvider:launchOptions:(NSURL* bundleURL, RCTBridgeModuleListProvider block, NSDictionary* launchOptions); public virtual instancetype initWithDelegate:launchOptions:(id delegate, NSDictionary* launchOptions); - public virtual void enqueueJSCall:args:(NSString* moduleDotMethod, NSArray* args); - public virtual void enqueueJSCall:method:args:completion:(NSString* module, NSString* method, NSArray* args, dispatch_block_t completion); public virtual void onFastRefresh(); public virtual void registerSegmentWithId:path:(NSUInteger segmentId, NSString* path); - public virtual void reload(); - public virtual void reloadWithReason:(NSString* reason); - public virtual void requestReload(); public virtual void setRCTTurboModuleRegistry:(id turboModuleRegistry); } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index a829d072a94a..f15992f3c172 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -652,28 +652,18 @@ interface RCTBlobManager : public NSObject { public @property (assign, readonly) BOOL loading; public @property (assign, readonly) BOOL valid; - public @property (copy, readonly) NSArray* moduleClasses; public @property (copy, readonly) NSDictionary* launchOptions; public @property (strong) Class executorClass; public @property (strong, readonly) NSURL* bundleURL; public @property (strong, readonly) RCTPerformanceLogger* performanceLogger; - public @property (weak, readonly) id delegate; - public virtual BOOL isBatchActive(); - public virtual BOOL moduleIsInitialized:(Class moduleClass); - public virtual NSArray* modulesConformingToProtocol:(Protocol* protocol); public virtual RCTBridgeModuleDecorator* bridgeModuleDecorator(); public virtual id moduleForClass:(Class moduleClass); public virtual id moduleForName:(NSString* moduleName); public virtual id moduleForName:lazilyLoadIfNecessary:(NSString* moduleName, BOOL lazilyLoad); public virtual instancetype initWithBundleURL:moduleProvider:launchOptions:(NSURL* bundleURL, RCTBridgeModuleListProvider block, NSDictionary* launchOptions); public virtual instancetype initWithDelegate:launchOptions:(id delegate, NSDictionary* launchOptions); - public virtual void enqueueJSCall:args:(NSString* moduleDotMethod, NSArray* args); - public virtual void enqueueJSCall:method:args:completion:(NSString* module, NSString* method, NSArray* args, dispatch_block_t completion); public virtual void onFastRefresh(); public virtual void registerSegmentWithId:path:(NSUInteger segmentId, NSString* path); - public virtual void reload(); - public virtual void reloadWithReason:(NSString* reason); - public virtual void requestReload(); public virtual void setRCTTurboModuleRegistry:(id turboModuleRegistry); } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index 8c9740672cdf..c9e8606d3b12 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -652,28 +652,18 @@ interface RCTBlobManager : public NSObject { public @property (assign, readonly) BOOL loading; public @property (assign, readonly) BOOL valid; - public @property (copy, readonly) NSArray* moduleClasses; public @property (copy, readonly) NSDictionary* launchOptions; public @property (strong) Class executorClass; public @property (strong, readonly) NSURL* bundleURL; public @property (strong, readonly) RCTPerformanceLogger* performanceLogger; - public @property (weak, readonly) id delegate; - public virtual BOOL isBatchActive(); - public virtual BOOL moduleIsInitialized:(Class moduleClass); - public virtual NSArray* modulesConformingToProtocol:(Protocol* protocol); public virtual RCTBridgeModuleDecorator* bridgeModuleDecorator(); public virtual id moduleForClass:(Class moduleClass); public virtual id moduleForName:(NSString* moduleName); public virtual id moduleForName:lazilyLoadIfNecessary:(NSString* moduleName, BOOL lazilyLoad); public virtual instancetype initWithBundleURL:moduleProvider:launchOptions:(NSURL* bundleURL, RCTBridgeModuleListProvider block, NSDictionary* launchOptions); public virtual instancetype initWithDelegate:launchOptions:(id delegate, NSDictionary* launchOptions); - public virtual void enqueueJSCall:args:(NSString* moduleDotMethod, NSArray* args); - public virtual void enqueueJSCall:method:args:completion:(NSString* module, NSString* method, NSArray* args, dispatch_block_t completion); public virtual void onFastRefresh(); public virtual void registerSegmentWithId:path:(NSUInteger segmentId, NSString* path); - public virtual void reload(); - public virtual void reloadWithReason:(NSString* reason); - public virtual void requestReload(); public virtual void setRCTTurboModuleRegistry:(id turboModuleRegistry); }