Delete gutted RCTModuleData class and its dead imports (#59426)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/59426

`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

Reviewed By: cipolleschi

Differential Revision: D127228438

fbshipit-source-id: adbc0bdccf9216d5b1defd93ea5f32890ef5bd49
This commit is contained in:
Christoph Purrer authored and meta-codesync[bot] committed 2026-10-26 07:59:48 -07:00
1 parent f2f393f086
commit f76f251b62
13 files changed
-253

No files matched your search

@@ -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"
@@ -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 <Foundation/Foundation.h>
#import <React/RCTInvalidating.h>
@protocol RCTBridgeMethod;
@protocol RCTBridgeModule;
@class RCTBridge;
@class RCTModuleData;
@class RCTModuleRegistry;
@class RCTViewRegistry;
@class RCTBundleManager;
@class RCTCallableJSModules;
@class RCTCallInvoker;
typedef id<RCTBridgeModule> (^RCTBridgeModuleProvider)(void);
@protocol RCTModuleDataCallInvokerProvider <NSObject>
- (RCTCallInvoker *)callInvokerForModuleData:(RCTModuleData *)moduleData;
@end
@interface RCTModuleData : NSObject <RCTInvalidating>
- (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<RCTBridgeModule>)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<id<RCTBridgeMethod>> *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<NSString *, id<RCTBridgeMethod>> *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<NSString *, id> *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<RCTBridgeModule> 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<RCTModuleDataCallInvokerProvider> callInvokerProvider __deprecated_msg(
"This API will be removed along with the legacy architecture.");
@end
@@ -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<RCTBridgeModule>)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
@@ -11,7 +11,6 @@
#import <Foundation/Foundation.h>
@class RCTBridge;
@class RCTModuleData;
namespace facebook::react {
@@ -7,7 +7,6 @@
#import "RCTCxxUtils.h"
#import <React/RCTModuleData.h>
#import <React/RCTUtils.h>
#import <cxxreact/CxxNativeModule.h>
#import <jsi/jsi.h>
@@ -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"
@@ -15,7 +15,6 @@
#include <React/RCTBridgeProxy.h>
#include <React/RCTComponentData.h>
#include <React/RCTEventDispatcher.h>
#include <React/RCTModuleData.h>
#import <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.h>
#include <react/utils/ContextContainer.h>
@@ -14,7 +14,6 @@
#include <React/RCTBridgeProxy.h>
#include <React/RCTComponentData.h>
#include <React/RCTEventDispatcherProtocol.h>
#include <React/RCTModuleData.h>
#include <React/RCTModuleMethod.h>
#include <React/RCTUIManager.h>
#include <React/RCTUIManagerUtils.h>
@@ -29,7 +29,6 @@
#import <React/RCTEventDispatcherProtocol.h>
#import <React/RCTLog.h>
#import <React/RCTLogBox.h>
#import <React/RCTModuleData.h>
#import <React/RCTPerformanceLogger.h>
#import <React/RCTRedBox.h>
#import <React/RCTSurfacePresenter.h>
@@ -1349,22 +1349,6 @@ interface RCTModalHostViewComponentView : public RCTViewComponentView <UIAdaptiv
public virtual void presentViewController:animated:completion:(UIViewController* modalViewController, BOOL animated, void(^)(void) completion);
}
interface RCTModuleData : public NSObject <RCTInvalidating> {
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<id<RCTBridgeMethod>>* methods;
public @property (copy, readonly) NSDictionary<NSString*, id<RCTBridgeMethod>>* methodsByName;
public @property (copy, readonly) NSDictionary<NSString*, id>* exportedConstants;
public @property (copy, readonly) NSString* name;
public @property (strong) id<RCTBridgeModule> instance;
public @property (strong, readonly) Class moduleClass;
public @property (strong, readonly) dispatch_queue_t methodQueue;
public @property (weak) id<RCTModuleDataCallInvokerProvider> callInvokerProvider;
public virtual void gatherConstants();
}
interface RCTModuleMethod : public NSObject <RCTBridgeMethod> {
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<facebook::react::TurboModule> getTurboModule:(const facebook::react::ObjCTurboModule::InitParams& params);
}
@@ -1392,22 +1392,6 @@ interface RCTModalHostViewComponentView : public RCTViewComponentView <UIAdaptiv
public virtual void presentViewController:animated:completion:(UIViewController* modalViewController, BOOL animated, void(^)(void) completion);
}
interface RCTModuleData : public NSObject <RCTInvalidating> {
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<id<RCTBridgeMethod>>* methods;
public @property (copy, readonly) NSDictionary<NSString*, id<RCTBridgeMethod>>* methodsByName;
public @property (copy, readonly) NSDictionary<NSString*, id>* exportedConstants;
public @property (copy, readonly) NSString* name;
public @property (strong) id<RCTBridgeModule> instance;
public @property (strong, readonly) Class moduleClass;
public @property (strong, readonly) dispatch_queue_t methodQueue;
public @property (weak) id<RCTModuleDataCallInvokerProvider> callInvokerProvider;
public virtual void gatherConstants();
}
interface RCTModuleMethod : public NSObject <RCTBridgeMethod> {
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<facebook::react::TurboModule> getTurboModule:(const facebook::react::ObjCTurboModule::InitParams& params);
}
@@ -1349,22 +1349,6 @@ interface RCTModalHostViewComponentView : public RCTViewComponentView <UIAdaptiv
public virtual void presentViewController:animated:completion:(UIViewController* modalViewController, BOOL animated, void(^)(void) completion);
}
interface RCTModuleData : public NSObject <RCTInvalidating> {
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<id<RCTBridgeMethod>>* methods;
public @property (copy, readonly) NSDictionary<NSString*, id<RCTBridgeMethod>>* methodsByName;
public @property (copy, readonly) NSDictionary<NSString*, id>* exportedConstants;
public @property (copy, readonly) NSString* name;
public @property (strong) id<RCTBridgeModule> instance;
public @property (strong, readonly) Class moduleClass;
public @property (strong, readonly) dispatch_queue_t methodQueue;
public @property (weak) id<RCTModuleDataCallInvokerProvider> callInvokerProvider;
public virtual void gatherConstants();
}
interface RCTModuleMethod : public NSObject <RCTBridgeMethod> {
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<facebook::react::TurboModule> getTurboModule:(const facebook::react::ObjCTurboModule::InitParams& params);
}
@@ -1349,22 +1349,6 @@ interface RCTModalHostViewComponentView : public RCTViewComponentView <UIAdaptiv
public virtual void presentViewController:animated:completion:(UIViewController* modalViewController, BOOL animated, void(^)(void) completion);
}
interface RCTModuleData : public NSObject <RCTInvalidating> {
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<id<RCTBridgeMethod>>* methods;
public @property (copy, readonly) NSDictionary<NSString*, id<RCTBridgeMethod>>* methodsByName;
public @property (copy, readonly) NSDictionary<NSString*, id>* exportedConstants;
public @property (copy, readonly) NSString* name;
public @property (strong) id<RCTBridgeModule> instance;
public @property (strong, readonly) Class moduleClass;
public @property (strong, readonly) dispatch_queue_t methodQueue;
public @property (weak) id<RCTModuleDataCallInvokerProvider> callInvokerProvider;
public virtual void gatherConstants();
}
interface RCTModuleMethod : public NSObject <RCTBridgeMethod> {
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<facebook::react::TurboModule> getTurboModule:(const facebook::react::ObjCTurboModule::InitParams& params);
}