Skip to content

Commit 01d5527

Browse files
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: #59440
1 parent 7b8dee1 commit 01d5527

13 files changed

Lines changed: 17 additions & 57 deletions

File tree

‎packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ - (void)hostDidStart:(RCTHost *)host
104104

105105
#pragma mark - RCTArchConfiguratorProtocol
106106

107-
- (BOOL)newArchEnabled
108-
{
109-
return YES;
110-
}
111-
112107
- (Class)getModuleClassFromName:(const char *)name
113108
{
114109
return nullptr;

‎packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ - (RCTRootViewFactory *)createRCTRootViewFactory
289289
};
290290

291291
RCTRootViewFactoryConfiguration *configuration =
292-
[[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock newArchEnabled:YES];
292+
[[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock];
293293

294294
configuration.customizeRootView = ^(UIView *_Nonnull rootView) {
295295
[weakSelf.delegate customizeRootView:(RCTRootView *)rootView];

‎packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,16 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
5656
* pointing to a path inside the app resources, e.g. `file://.../main.jsbundle`.
5757
*
5858
*/
59+
- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock NS_DESIGNATED_INITIALIZER;
60+
61+
- (instancetype)initWithBundleURL:(NSURL *)bundleURL;
62+
5963
- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock
60-
newArchEnabled:(BOOL)newArchEnabled NS_DESIGNATED_INITIALIZER;
64+
newArchEnabled:(BOOL)newArchEnabled
65+
__deprecated_msg("The flag is ignored; use initWithBundleURLBlock:.");
6166

62-
- (instancetype)initWithBundleURL:(NSURL *)bundleURL newArchEnabled:(BOOL)newArchEnabled;
67+
- (instancetype)initWithBundleURL:(NSURL *)bundleURL
68+
newArchEnabled:(BOOL)newArchEnabled __deprecated_msg("The flag is ignored; use initWithBundleURL:.");
6369

6470
/**
6571
* Block that allows to override logic of creating root view instance.

‎packages/react-native/React/Base/RCTBridge.h‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,6 @@ NSString *RCTBridgeModuleNameForClass(Class bridgeModuleClass);
4343
*/
4444
NSMutableArray<NSString *> *getModulesLoadedWithOldArch(void);
4545

46-
/**
47-
* The New Architecture is enabled by default. These APIs are no-ops and will
48-
* be removed in a future release.
49-
*/
50-
BOOL RCTTurboModuleEnabled(void)
51-
__attribute__((deprecated("TurboModules are always enabled; this always returns YES (NO in test env).")));
52-
void RCTEnableTurboModule(BOOL enabled)
53-
__attribute__((deprecated("No-op. The New Architecture is enabled by default.")));
54-
5546
#ifndef RCT_REMOVE_LEGACY_MODULE_INTEROP
5647
// Turn on TurboModule interop
5748
BOOL RCTTurboModuleInteropEnabled(void);
@@ -64,9 +55,6 @@ BOOL RCTFabricInteropLayerEnabled(void);
6455
void RCTEnableFabricInteropLayer(BOOL enabled);
6556
#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP
6657

67-
BOOL RCTUIManagerDispatchAccessibilityManagerInitOntoMain(void);
68-
void RCTUIManagerSetDispatchAccessibilityManagerInitOntoMain(BOOL enabled);
69-
7058
typedef enum {
7159
kRCTBridgeProxyLoggingLevelNone,
7260
kRCTBridgeProxyLoggingLevelWarning,

‎packages/react-native/React/Base/RCTBridge.mm‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,6 @@ void RCTRegisterModule(Class moduleClass)
182182
return RCTDropReactPrefixes(name);
183183
}
184184

185-
BOOL RCTTurboModuleEnabled(void)
186-
{
187-
return YES;
188-
}
189-
190-
void RCTEnableTurboModule(BOOL enabled)
191-
{
192-
// The new Architecture is enabled by default and we are ignoring changes to the TurboModule system.
193-
}
194-
195185
#ifndef RCT_REMOVE_LEGACY_MODULE_INTEROP
196186
static BOOL turboModuleInteropEnabled = NO;
197187
BOOL RCTTurboModuleInteropEnabled(void)
@@ -228,17 +218,6 @@ void RCTSetTurboModuleInteropBridgeProxyLogLevel(RCTBridgeProxyLoggingLevel logL
228218
bridgeProxyLoggingLevel = logLevel;
229219
}
230220

231-
BOOL kDispatchAccessibilityManagerInitOntoMain = NO;
232-
BOOL RCTUIManagerDispatchAccessibilityManagerInitOntoMain(void)
233-
{
234-
return kDispatchAccessibilityManagerInitOntoMain;
235-
}
236-
237-
void RCTUIManagerSetDispatchAccessibilityManagerInitOntoMain(BOOL enabled)
238-
{
239-
kDispatchAccessibilityManagerInitOntoMain = enabled;
240-
}
241-
242221
@implementation RCTBridge
243222
- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)delegate launchOptions:(NSDictionary *)launchOptions
244223
{

‎packages/react-native/React/Base/RCTBridgeModule.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,6 @@ RCT_EXTERN_C_END
402402
*/
403403
- (NSDictionary *)constantsToExport;
404404

405-
/**
406-
* Notifies the module that a batch of JS method invocations has just completed.
407-
*/
408-
- (void)batchDidComplete RCT_DEPRECATED;
409-
410405
@end
411406

412407
/**

‎packages/react-native/React/Base/RCTJavaScriptExecutor.h‎

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

1313
typedef void (^RCTJavaScriptCompleteBlock)(NSError *__strong)
1414
__deprecated_msg("This api will be removed along with the bridge.");
15-
typedef void (^RCTJavaScriptCallback)(__strong id, NSError *__strong)
16-
__deprecated_msg("This api will be removed along with the bridge.");

‎packages/react-native/React/CoreModules/RCTPerfMonitor.mm‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#import <React/RCTFPSGraph.h>
2323
#import <React/RCTInitializing.h>
2424
#import <React/RCTInvalidating.h>
25-
#import <React/RCTJavaScriptExecutor.h>
2625
#import <React/RCTPerformanceLogger.h>
2726
#import <React/RCTPerformanceLoggerLabels.h>
2827
#import <React/RCTRootView.h>

‎packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
#import <unordered_map>
2323
#import <vector>
2424

25-
#define RCT_IS_TURBO_MODULE_CLASS(klass) \
26-
((RCTTurboModuleEnabled() && [(klass) conformsToProtocol:@protocol(RCTTurboModule)]))
27-
#define RCT_IS_TURBO_MODULE_INSTANCE(module) RCT_IS_TURBO_MODULE_CLASS([(module) class])
28-
2925
namespace facebook::react {
3026

3127
class CallbackWrapper;

‎scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,9 @@ interface RCTRootViewFactoryConfiguration : public NSObject {
16111611
public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress;
16121612
public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge;
16131613
public @property (weak) id<RCTJSRuntimeConfiguratorProtocol> jsRuntimeConfiguratorDelegate;
1614+
public virtual instancetype initWithBundleURL:(NSURL* bundleURL);
16141615
public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled);
1616+
public virtual instancetype initWithBundleURLBlock:(RCTBundleURLBlock bundleURLBlock);
16151617
public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled);
16161618
}
16171619

@@ -2545,7 +2547,6 @@ protocol RCTBridgeModule : public NSObject {
25452547
public virtual _Nullable NSArray<id<RCTBridgeMethod>>* methodsToExport();
25462548
public virtual static BOOL requiresMainQueueSetup();
25472549
public virtual static NSString* moduleName();
2548-
public virtual void batchDidComplete();
25492550
}
25502551

25512552
protocol RCTCallInvokerModule : public NSObject {

0 commit comments

Comments
 (0)