From 8d2ca7908476ab3fb55949084a8b6941e0b26378 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 27 Oct 2026 15:18:41 -0700 Subject: [PATCH 1/3] Delete dead RCTCxxBridgeDelegate protocol (#59441) 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 Reviewed By: zeyap 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 e04f3b738889..47eed48b6b07 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 b6fcaa20bde3..dc5c2df233bd 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 9010fcf23951..4f1f68698b7c 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 6bb9397bd2e4..690d97671e9d 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 571c38cbf39ee692b54cc1b7496b6d5b06c3d9b9 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 27 Oct 2026 15:18:41 -0700 Subject: [PATCH 2/3] Delete dead per-module RCTBridge accessors (#59443) 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 Reviewed By: cipolleschi 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 47eed48b6b07..db29793ca43d 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 dc5c2df233bd..99fbb266a43e 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 4f1f68698b7c..9c68406bec42 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 690d97671e9d..376f60c1958b 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 7583d1dd77ef953e2044b5709b0bfa0cf660b3d3 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 27 Oct 2026 15:18:41 -0700 Subject: [PATCH 3/3] Delete dead RCTBridge public API and skipped logging tests (#59429) Summary: 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` Reviewed By: andrewdacenko 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 db29793ca43d..5e250e9dc44c 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 99fbb266a43e..ab9ff0752f50 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 9c68406bec42..abde7a0ac82d 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 376f60c1958b..56ec7d9f2aea 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); }