From 499eddafa56a55657518e93f6f4cf4eadd2e0101 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 23 Oct 2026 20:19:17 -0700 Subject: [PATCH] Delete gutted RCTModuleData class and its dead imports (#59426) Summary: `RCTModuleData` is never instantiated and its implementation is a stub: initializers return `self`, and `gatherConstants`/`invalidate` are no-ops. Delete the header and implementation with the unused `RCTBridgeModuleProvider` typedef and `RCTModuleDataCallInvokerProvider` protocol, plus the buck header-map entry and all import sites. Changelog: [iOS][Removed] - Remove deprecated `RCTModuleData` class and its call-invoker provider protocol Differential Revision: D127228438 --- packages/react-native/React/Base/RCTBridge.mm | 1 - .../react-native/React/Base/RCTModuleData.h | 123 ------------------ .../react-native/React/Base/RCTModuleData.mm | 43 ------ .../React/CxxModule/RCTCxxUtils.h | 1 - .../React/CxxModule/RCTCxxUtils.mm | 1 - .../React/Modules/RCTUIManager.mm | 1 - ...cyViewManagerInteropComponentDescriptor.mm | 1 - .../RCTLegacyViewManagerInteropCoordinator.mm | 1 - .../platform/ios/ReactCommon/RCTInstance.mm | 1 - .../api-snapshots/ReactAppleDebugCxx.api | 20 --- .../api-snapshots/ReactAppleFrameworksCxx.api | 20 --- .../api-snapshots/ReactAppleNewarchCxx.api | 20 --- .../api-snapshots/ReactAppleReleaseCxx.api | 20 --- 13 files changed, 253 deletions(-) delete mode 100644 packages/react-native/React/Base/RCTModuleData.h delete mode 100644 packages/react-native/React/Base/RCTModuleData.mm diff --git a/packages/react-native/React/Base/RCTBridge.mm b/packages/react-native/React/Base/RCTBridge.mm index 44b3cdcd2e7f..ec1c948ed964 100644 --- a/packages/react-native/React/Base/RCTBridge.mm +++ b/packages/react-native/React/Base/RCTBridge.mm @@ -24,7 +24,6 @@ #import "RCTInspectorUtils.h" #import "RCTJSThread.h" #import "RCTLog.h" -#import "RCTModuleData.h" #import "RCTPausedInDebuggerOverlayController.h" #import "RCTPerformanceLogger.h" #import "RCTReloadCommand.h" diff --git a/packages/react-native/React/Base/RCTModuleData.h b/packages/react-native/React/Base/RCTModuleData.h deleted file mode 100644 index 812991e4d26a..000000000000 --- a/packages/react-native/React/Base/RCTModuleData.h +++ /dev/null @@ -1,123 +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 - -@protocol RCTBridgeMethod; -@protocol RCTBridgeModule; -@class RCTBridge; -@class RCTModuleData; -@class RCTModuleRegistry; -@class RCTViewRegistry; -@class RCTBundleManager; -@class RCTCallableJSModules; -@class RCTCallInvoker; - -typedef id (^RCTBridgeModuleProvider)(void); - -@protocol RCTModuleDataCallInvokerProvider - -- (RCTCallInvoker *)callInvokerForModuleData:(RCTModuleData *)moduleData; - -@end - -@interface RCTModuleData : NSObject - -- (instancetype)initWithModuleClass:(Class)moduleClass - bridge:(RCTBridge *)bridge - moduleRegistry:(RCTModuleRegistry *)moduleRegistry - viewRegistry_DEPRECATED:(RCTViewRegistry *)viewRegistry_DEPRECATED - bundleManager:(RCTBundleManager *)bundleManager - callableJSModules:(RCTCallableJSModules *)callableJSModules NS_DESIGNATED_INITIALIZER - __deprecated_msg("This API will be removed along with the legacy architecture."); - -- (instancetype)initWithModuleInstance:(id)instance - bridge:(RCTBridge *)bridge - moduleRegistry:(RCTModuleRegistry *)moduleRegistry - viewRegistry_DEPRECATED:(RCTViewRegistry *)viewRegistry_DEPRECATED - bundleManager:(RCTBundleManager *)bundleManager - callableJSModules:(RCTCallableJSModules *)callableJSModules NS_DESIGNATED_INITIALIZER - __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * Calls `constantsToExport` on the module and stores the result. Note that - * this will init the module if it has not already been created. This method - * can be called on any thread, but may block the main thread briefly if the - * module implements `constantsToExport`. - */ -- (void)gatherConstants __deprecated_msg("This API will be removed along with the legacy architecture."); - -@property (nonatomic, strong, readonly) - Class moduleClass __deprecated_msg("This API will be removed along with the legacy architecture."); -@property (nonatomic, copy, readonly) - NSString *name __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * Returns the module methods. Note that this will gather the methods the first - * time it is called and then memoize the results. - */ -@property (nonatomic, copy, readonly) NSArray> *methods __deprecated_msg( - "This API will be removed along with the legacy architecture."); - -/** - * Returns a map of the module methods. Note that this will gather the methods the first - * time it is called and then memoize the results. - */ -@property (nonatomic, copy, readonly) NSDictionary> *methodsByName __deprecated_msg( - "This API will be removed along with the legacy architecture."); - -/** - * Returns the module's constants, if it exports any - */ -@property (nonatomic, copy, readonly) NSDictionary *exportedConstants __deprecated_msg( - "This API will be removed along with the legacy architecture."); - -/** - * Returns YES if module instance has already been initialized; NO otherwise. - */ -@property (nonatomic, assign, readonly) - BOOL hasInstance __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * Returns YES if module instance must be created on the main thread. - */ -@property (nonatomic, assign) - BOOL requiresMainQueueSetup __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * Returns YES if module has constants to export. - */ -@property (nonatomic, assign, readonly) - BOOL hasConstantsToExport __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * Returns the current module instance. Note that this will init the instance - * if it has not already been created. To check if the module instance exists - * without causing it to be created, use `hasInstance` instead. - */ -@property (nonatomic, strong, readwrite) id instance __deprecated_msg( - "This API will be removed along with the legacy architecture."); - -/** - * Returns the module method dispatch queue. Note that this will init both the - * queue and the module itself if they have not already been created. - */ -@property (nonatomic, strong, readonly) - dispatch_queue_t methodQueue __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * Whether the receiver has a valid `instance` which implements -batchDidComplete. - */ -@property (nonatomic, assign, readonly) - BOOL implementsBatchDidComplete __deprecated_msg("This API will be removed along with the legacy architecture."); - -@property (nonatomic, weak, readwrite) id callInvokerProvider __deprecated_msg( - "This API will be removed along with the legacy architecture."); - -@end diff --git a/packages/react-native/React/Base/RCTModuleData.mm b/packages/react-native/React/Base/RCTModuleData.mm deleted file mode 100644 index e52d9008deb8..000000000000 --- a/packages/react-native/React/Base/RCTModuleData.mm +++ /dev/null @@ -1,43 +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 "RCTModuleData.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-designated-initializers" - -@implementation RCTModuleData - -- (instancetype)initWithModuleClass:(Class)moduleClass - bridge:(RCTBridge *)bridge - moduleRegistry:(RCTModuleRegistry *)moduleRegistry - viewRegistry_DEPRECATED:(RCTViewRegistry *)viewRegistry_DEPRECATED - bundleManager:(RCTBundleManager *)bundleManager - callableJSModules:(RCTCallableJSModules *)callableJSModules -{ - return self; -} - -- (instancetype)initWithModuleInstance:(id)instance - bridge:(RCTBridge *)bridge - moduleRegistry:(RCTModuleRegistry *)moduleRegistry - viewRegistry_DEPRECATED:(RCTViewRegistry *)viewRegistry_DEPRECATED - bundleManager:(RCTBundleManager *)bundleManager - callableJSModules:(RCTCallableJSModules *)callableJSModules -{ - return self; -} - -- (void)gatherConstants -{ -} - -- (void)invalidate -{ -} - -@end diff --git a/packages/react-native/React/CxxModule/RCTCxxUtils.h b/packages/react-native/React/CxxModule/RCTCxxUtils.h index 1235c181de0a..dc4c25dec740 100644 --- a/packages/react-native/React/CxxModule/RCTCxxUtils.h +++ b/packages/react-native/React/CxxModule/RCTCxxUtils.h @@ -11,7 +11,6 @@ #import @class RCTBridge; -@class RCTModuleData; namespace facebook::react { diff --git a/packages/react-native/React/CxxModule/RCTCxxUtils.mm b/packages/react-native/React/CxxModule/RCTCxxUtils.mm index e3009bd5f852..386ac5fd1697 100644 --- a/packages/react-native/React/CxxModule/RCTCxxUtils.mm +++ b/packages/react-native/React/CxxModule/RCTCxxUtils.mm @@ -7,7 +7,6 @@ #import "RCTCxxUtils.h" -#import #import #import #import diff --git a/packages/react-native/React/Modules/RCTUIManager.mm b/packages/react-native/React/Modules/RCTUIManager.mm index 3e7eba4aae4a..1ab3804b0398 100644 --- a/packages/react-native/React/Modules/RCTUIManager.mm +++ b/packages/react-native/React/Modules/RCTUIManager.mm @@ -22,7 +22,6 @@ #import "RCTLayoutAnimation.h" #import "RCTLayoutAnimationGroup.h" #import "RCTLog.h" -#import "RCTModuleData.h" #import "RCTModuleMethod.h" #import "RCTScrollableProtocol.h" #import "RCTShadowView.h" diff --git a/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm b/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm index 6d5c8ec8410f..a467d5802d40 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm +++ b/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm @@ -15,7 +15,6 @@ #include #include #include -#include #import #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm b/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm index 1bfe6677c629..e6251007b4e9 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +++ b/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm index 40480593c587..0e5fb188f7cb 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm @@ -29,7 +29,6 @@ #import #import #import -#import #import #import #import diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 8de2c49759a6..9815b007ef82 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -1349,22 +1349,6 @@ interface RCTModalHostViewComponentView : public RCTViewComponentView { - public @property (assign) BOOL requiresMainQueueSetup; - public @property (assign, readonly) BOOL hasConstantsToExport; - public @property (assign, readonly) BOOL hasInstance; - public @property (assign, readonly) BOOL implementsBatchDidComplete; - public @property (copy, readonly) NSArray>* methods; - public @property (copy, readonly) NSDictionary>* methodsByName; - public @property (copy, readonly) NSDictionary* exportedConstants; - public @property (copy, readonly) NSString* name; - public @property (strong) id instance; - public @property (strong, readonly) Class moduleClass; - public @property (strong, readonly) dispatch_queue_t methodQueue; - public @property (weak) id callInvokerProvider; - public virtual void gatherConstants(); -} - interface RCTModuleMethod : public NSObject { public @property (assign, readonly) Class moduleClass; public @property (assign, readonly) SEL selector; @@ -2793,10 +2777,6 @@ protocol RCTLocalizationProtocol : public NSObject { protocol RCTModalHostViewViewProtocol : public NSObject { } -protocol RCTModuleDataCallInvokerProvider : public NSObject { - public virtual RCTCallInvoker* callInvokerForModuleData:(RCTModuleData* moduleData); -} - protocol RCTModuleProvider : public NSObjectNSObject { public virtual std::shared_ptr getTurboModule:(const facebook::react::ObjCTurboModule::InitParams& params); } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api index 6b5e45141f07..7d95a55afddb 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api @@ -1392,22 +1392,6 @@ interface RCTModalHostViewComponentView : public RCTViewComponentView { - public @property (assign) BOOL requiresMainQueueSetup; - public @property (assign, readonly) BOOL hasConstantsToExport; - public @property (assign, readonly) BOOL hasInstance; - public @property (assign, readonly) BOOL implementsBatchDidComplete; - public @property (copy, readonly) NSArray>* methods; - public @property (copy, readonly) NSDictionary>* methodsByName; - public @property (copy, readonly) NSDictionary* exportedConstants; - public @property (copy, readonly) NSString* name; - public @property (strong) id instance; - public @property (strong, readonly) Class moduleClass; - public @property (strong, readonly) dispatch_queue_t methodQueue; - public @property (weak) id callInvokerProvider; - public virtual void gatherConstants(); -} - interface RCTModuleMethod : public NSObject { public @property (assign, readonly) Class moduleClass; public @property (assign, readonly) SEL selector; @@ -2874,10 +2858,6 @@ protocol RCTLocalizationProtocol : public NSObject { protocol RCTModalHostViewViewProtocol : public NSObject { } -protocol RCTModuleDataCallInvokerProvider : public NSObject { - public virtual RCTCallInvoker* callInvokerForModuleData:(RCTModuleData* moduleData); -} - protocol RCTModuleProvider : public NSObjectNSObject { public virtual std::shared_ptr getTurboModule:(const facebook::react::ObjCTurboModule::InitParams& params); } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index e8201541b2e1..e74431082e29 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -1349,22 +1349,6 @@ interface RCTModalHostViewComponentView : public RCTViewComponentView { - public @property (assign) BOOL requiresMainQueueSetup; - public @property (assign, readonly) BOOL hasConstantsToExport; - public @property (assign, readonly) BOOL hasInstance; - public @property (assign, readonly) BOOL implementsBatchDidComplete; - public @property (copy, readonly) NSArray>* methods; - public @property (copy, readonly) NSDictionary>* methodsByName; - public @property (copy, readonly) NSDictionary* exportedConstants; - public @property (copy, readonly) NSString* name; - public @property (strong) id instance; - public @property (strong, readonly) Class moduleClass; - public @property (strong, readonly) dispatch_queue_t methodQueue; - public @property (weak) id callInvokerProvider; - public virtual void gatherConstants(); -} - interface RCTModuleMethod : public NSObject { public @property (assign, readonly) Class moduleClass; public @property (assign, readonly) SEL selector; @@ -2785,10 +2769,6 @@ protocol RCTLocalizationProtocol : public NSObject { protocol RCTModalHostViewViewProtocol : public NSObject { } -protocol RCTModuleDataCallInvokerProvider : public NSObject { - public virtual RCTCallInvoker* callInvokerForModuleData:(RCTModuleData* moduleData); -} - protocol RCTModuleProvider : public NSObjectNSObject { public virtual std::shared_ptr getTurboModule:(const facebook::react::ObjCTurboModule::InitParams& params); } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index d3ff97cc59c6..08697b483f6e 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -1349,22 +1349,6 @@ interface RCTModalHostViewComponentView : public RCTViewComponentView { - public @property (assign) BOOL requiresMainQueueSetup; - public @property (assign, readonly) BOOL hasConstantsToExport; - public @property (assign, readonly) BOOL hasInstance; - public @property (assign, readonly) BOOL implementsBatchDidComplete; - public @property (copy, readonly) NSArray>* methods; - public @property (copy, readonly) NSDictionary>* methodsByName; - public @property (copy, readonly) NSDictionary* exportedConstants; - public @property (copy, readonly) NSString* name; - public @property (strong) id instance; - public @property (strong, readonly) Class moduleClass; - public @property (strong, readonly) dispatch_queue_t methodQueue; - public @property (weak) id callInvokerProvider; - public virtual void gatherConstants(); -} - interface RCTModuleMethod : public NSObject { public @property (assign, readonly) Class moduleClass; public @property (assign, readonly) SEL selector; @@ -2793,10 +2777,6 @@ protocol RCTLocalizationProtocol : public NSObject { protocol RCTModalHostViewViewProtocol : public NSObject { } -protocol RCTModuleDataCallInvokerProvider : public NSObject { - public virtual RCTCallInvoker* callInvokerForModuleData:(RCTModuleData* moduleData); -} - protocol RCTModuleProvider : public NSObjectNSObject { public virtual std::shared_ptr getTurboModule:(const facebook::react::ObjCTurboModule::InitParams& params); }