From 01d55273bcf17b6b3b59eab7e9ea7da060d46491 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 27 Oct 2026 11:10:09 -0700 Subject: [PATCH] Delete dead bridge flag functions and module hooks (#59440) 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 Reviewed By: zeyap Differential Revision: D127294780 Pull Request resolved: https://github.com/react/react-native/pull/59440 --- .../RCTDefaultReactNativeFactoryDelegate.mm | 5 ----- .../AppDelegate/RCTReactNativeFactory.mm | 2 +- .../AppDelegate/RCTRootViewFactory.h | 12 ++++++++--- 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, 18 insertions(+), 58 deletions(-) diff --git a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm index 68c66feb8de..e72ceced827 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm @@ -104,11 +104,6 @@ #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 deba936037f..f5d7e554e67 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm @@ -289,7 +289,7 @@ static NSDictionary *RCTConvertConnectionOptionsToLaunchOptions(UISceneConnectio }; 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 14334a2c102..e7af4bb09b6 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 - newArchEnabled:(BOOL)newArchEnabled NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithBundleURL:(NSURL *)bundleURL newArchEnabled:(BOOL)newArchEnabled; +- (instancetype)initWithBundleURL:(NSURL *)bundleURL; + +- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock + newArchEnabled:(BOOL)newArchEnabled + __deprecated_msg("The flag is ignored; use initWithBundleURLBlock:."); + +- (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 38894bea192..d09cdeed3ed 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 ec1c948ed96..9998204e136 100644 --- a/packages/react-native/React/Base/RCTBridge.mm +++ b/packages/react-native/React/Base/RCTBridge.mm @@ -182,16 +182,6 @@ NSString *RCTBridgeModuleNameForClass(Class cls) 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 005e10d84f6..3f52bbb17a3 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 965d78e7361..2fdbe3079db 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 2bb27c1eaeb..9a7c4a9d362 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 d26d4f247ba..2e37b578236 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 56b0468d9e5..e04f3b73888 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 f43573d7080..b6fcaa20bde 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 9b51799a0d6..9010fcf2395 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 3a3cead6b6f..6bb9397bd2e 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 {