Skip to content

Commit d0802f7

Browse files
Delete dead RCTBridge public API and skipped logging tests
Summary: Remove `RCTBridge` declarations with zero callers: `enqueueJSCall`, module lookup, `delegate`, `moduleClasses`, reload, batch, and TurboModule-registry hooks, plus their stub implementations. Keep `bundleURL`, still read by Expo Dev Menu, and mark it 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` Differential Revision: D127265582
1 parent d7557f0 commit d0802f7

7 files changed

Lines changed: 2 additions & 310 deletions

File tree

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

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,6 @@ RCT_EXTERN_C_END
124124
launchOptions:(NSDictionary *)launchOptions
125125
__deprecated_msg("This API will be removed along with the legacy architecture.");
126126

127-
/**
128-
* This method is used to call functions in the JavaScript application context.
129-
* It is primarily intended for use by modules that require two-way communication
130-
* with the JavaScript code. Safe to call from any thread.
131-
*/
132-
- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args;
133-
- (void)enqueueJSCall:(NSString *)module
134-
method:(NSString *)method
135-
args:(NSArray *)args
136-
completion:(dispatch_block_t)completion;
137-
138127
/**
139128
* This method registers the file path of an additional JS segment by its ID.
140129
*
@@ -155,54 +144,18 @@ RCT_EXTERN_C_END
155144
// Note: This method lazily load the module as necessary.
156145
- (id)moduleForClass:(Class)moduleClass;
157146

158-
/**
159-
* When a NativeModule performs a lookup for a TurboModule, we need to query
160-
* the TurboModuleRegistry.
161-
*/
162-
- (void)setRCTTurboModuleRegistry:(id<RCTTurboModuleRegistry>)turboModuleRegistry;
163-
164-
/**
165-
* This hook is called by the TurboModule infra with every ObjC module that's created.
166-
* It allows the bridge to attach properties to ObjC modules that give those modules
167-
* access to Bridge APIs.
168-
*/
169-
- (RCTBridgeModuleDecorator *)bridgeModuleDecorator;
170-
171-
/**
172-
* Convenience method for retrieving all modules conforming to a given protocol.
173-
* Modules will be synchronously instantiated if they haven't already been,
174-
* potentially blocking both the calling thread and main thread for a short time.
175-
*/
176-
- (NSArray *)modulesConformingToProtocol:(Protocol *)protocol;
177-
178-
/**
179-
* Test if a module has been initialized. Use this prior to calling
180-
* `moduleForClass:` or `moduleForName:` if you do not want to cause the module
181-
* to be instantiated if it hasn't been already.
182-
*/
183-
- (BOOL)moduleIsInitialized:(Class)moduleClass;
184-
185-
/**
186-
* All registered bridge module classes.
187-
*/
188-
@property (nonatomic, copy, readonly) NSArray<Class> *moduleClasses;
189-
190147
/**
191148
* URL of the script that was loaded into the bridge.
192149
*/
193-
@property (nonatomic, strong, readonly) NSURL *bundleURL;
150+
@property (nonatomic, strong, readonly)
151+
NSURL *bundleURL __deprecated_msg("This API will be removed along with the legacy architecture.");
194152

195153
/**
196154
* The class of the executor currently being used. Changes to this value will
197155
* take effect after the bridge is reloaded.
198156
*/
199157
@property (nonatomic, strong) Class executorClass;
200158

201-
/**
202-
* The delegate provided during the bridge initialization
203-
*/
204-
@property (nonatomic, weak, readonly) id<RCTBridgeDelegate> delegate;
205-
206159
/**
207160
* The launch options that were used to initialize the bridge.
208161
*/
@@ -223,29 +176,9 @@ RCT_EXTERN_C_END
223176
*/
224177
@property (nonatomic, readonly, strong) RCTPerformanceLogger *performanceLogger;
225178

226-
/**
227-
* Reload the bundle and reset executor & modules. Safe to call from any thread.
228-
*/
229-
- (void)reload __deprecated_msg("Use RCTReloadCommand instead");
230-
231-
/**
232-
* Reload the bundle and reset executor & modules. Safe to call from any thread.
233-
*/
234-
- (void)reloadWithReason:(NSString *)reason __deprecated_msg("Use RCTReloadCommand instead");
235-
236179
/**
237180
* Handle notifications for a fast refresh. Safe to call from any thread.
238181
*/
239182
- (void)onFastRefresh;
240183

241-
/**
242-
* Inform the bridge, and anything subscribing to it, that it should reload.
243-
*/
244-
- (void)requestReload __deprecated_msg("Use RCTReloadCommand instead");
245-
246-
/**
247-
* Says whether bridge has started receiving calls from JavaScript.
248-
*/
249-
- (BOOL)isBatchActive;
250-
251184
@end

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

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -253,17 +253,6 @@ - (instancetype)initWithBundleURL:(NSURL *)bundleURL
253253
return self;
254254
}
255255

256-
- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args
257-
{
258-
}
259-
260-
- (void)enqueueJSCall:(NSString *)module
261-
method:(NSString *)method
262-
args:(NSArray *)args
263-
completion:(__strong dispatch_block_t)completion
264-
{
265-
}
266-
267256
- (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path
268257
{
269258
}
@@ -283,46 +272,10 @@ - (id)moduleForClass:(Class)moduleClass
283272
return nil;
284273
}
285274

286-
- (void)setRCTTurboModuleRegistry:(id<RCTTurboModuleRegistry>)turboModuleRegistry
287-
{
288-
}
289-
290-
- (RCTBridgeModuleDecorator *)bridgeModuleDecorator
291-
{
292-
return nil;
293-
}
294-
295-
- (NSArray *)modulesConformingToProtocol:(Protocol *)protocol
296-
{
297-
return @[];
298-
}
299-
300-
- (BOOL)moduleIsInitialized:(Class)moduleClass
301-
{
302-
return NO;
303-
}
304-
305-
- (void)reload __attribute__((deprecated("Use RCTReloadCommand instead")))
306-
{
307-
}
308-
309-
- (void)reloadWithReason:(NSString *)reason __attribute__((deprecated("Use RCTReloadCommand instead")))
310-
{
311-
}
312-
313275
- (void)onFastRefresh
314276
{
315277
}
316278

317-
- (void)requestReload __attribute__((deprecated("Use RCTReloadCommand instead")))
318-
{
319-
}
320-
321-
- (BOOL)isBatchActive
322-
{
323-
return NO;
324-
}
325-
326279
- (void)enqueueCallback:(NSNumber *)cbID args:(NSArray *)args
327280
{
328281
}

‎packages/rn-tester/RNTesterIntegrationTests/RCTLoggingTests.m‎

Lines changed: 0 additions & 146 deletions
This file was deleted.

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -672,29 +672,17 @@ interface RCTBlobManager : public NSObject <RCTBridgeModule, RCTURLRequestHandle
672672
interface RCTBridge : public NSObject <RCTInvalidating> {
673673
public @property (assign, readonly) BOOL loading;
674674
public @property (assign, readonly) BOOL valid;
675-
public @property (copy, readonly) NSArray<Class>* moduleClasses;
676675
public @property (copy, readonly) NSDictionary* launchOptions;
677676
public @property (strong) Class executorClass;
678677
public @property (strong, readonly) NSURL* bundleURL;
679678
public @property (strong, readonly) RCTPerformanceLogger* performanceLogger;
680-
public @property (weak, readonly) id<RCTBridgeDelegate> delegate;
681-
public virtual BOOL isBatchActive();
682-
public virtual BOOL moduleIsInitialized:(Class moduleClass);
683-
public virtual NSArray* modulesConformingToProtocol:(Protocol* protocol);
684-
public virtual RCTBridgeModuleDecorator* bridgeModuleDecorator();
685679
public virtual id moduleForClass:(Class moduleClass);
686680
public virtual id moduleForName:(NSString* moduleName);
687681
public virtual id moduleForName:lazilyLoadIfNecessary:(NSString* moduleName, BOOL lazilyLoad);
688682
public virtual instancetype initWithBundleURL:moduleProvider:launchOptions:(NSURL* bundleURL, RCTBridgeModuleListProvider block, NSDictionary* launchOptions);
689683
public virtual instancetype initWithDelegate:launchOptions:(id<RCTBridgeDelegate> delegate, NSDictionary* launchOptions);
690-
public virtual void enqueueJSCall:args:(NSString* moduleDotMethod, NSArray* args);
691-
public virtual void enqueueJSCall:method:args:completion:(NSString* module, NSString* method, NSArray* args, dispatch_block_t completion);
692684
public virtual void onFastRefresh();
693685
public virtual void registerSegmentWithId:path:(NSUInteger segmentId, NSString* path);
694-
public virtual void reload();
695-
public virtual void reloadWithReason:(NSString* reason);
696-
public virtual void requestReload();
697-
public virtual void setRCTTurboModuleRegistry:(id<RCTTurboModuleRegistry> turboModuleRegistry);
698686
}
699687

700688
interface RCTBridgeModuleDecorator : public NSObject {

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -681,29 +681,17 @@ interface RCTBlobManager : public NSObject <RCTBridgeModule, RCTURLRequestHandle
681681
interface RCTBridge : public NSObject <RCTInvalidating> {
682682
public @property (assign, readonly) BOOL loading;
683683
public @property (assign, readonly) BOOL valid;
684-
public @property (copy, readonly) NSArray<Class>* moduleClasses;
685684
public @property (copy, readonly) NSDictionary* launchOptions;
686685
public @property (strong) Class executorClass;
687686
public @property (strong, readonly) NSURL* bundleURL;
688687
public @property (strong, readonly) RCTPerformanceLogger* performanceLogger;
689-
public @property (weak, readonly) id<RCTBridgeDelegate> delegate;
690-
public virtual BOOL isBatchActive();
691-
public virtual BOOL moduleIsInitialized:(Class moduleClass);
692-
public virtual NSArray* modulesConformingToProtocol:(Protocol* protocol);
693-
public virtual RCTBridgeModuleDecorator* bridgeModuleDecorator();
694688
public virtual id moduleForClass:(Class moduleClass);
695689
public virtual id moduleForName:(NSString* moduleName);
696690
public virtual id moduleForName:lazilyLoadIfNecessary:(NSString* moduleName, BOOL lazilyLoad);
697691
public virtual instancetype initWithBundleURL:moduleProvider:launchOptions:(NSURL* bundleURL, RCTBridgeModuleListProvider block, NSDictionary* launchOptions);
698692
public virtual instancetype initWithDelegate:launchOptions:(id<RCTBridgeDelegate> delegate, NSDictionary* launchOptions);
699-
public virtual void enqueueJSCall:args:(NSString* moduleDotMethod, NSArray* args);
700-
public virtual void enqueueJSCall:method:args:completion:(NSString* module, NSString* method, NSArray* args, dispatch_block_t completion);
701693
public virtual void onFastRefresh();
702694
public virtual void registerSegmentWithId:path:(NSUInteger segmentId, NSString* path);
703-
public virtual void reload();
704-
public virtual void reloadWithReason:(NSString* reason);
705-
public virtual void requestReload();
706-
public virtual void setRCTTurboModuleRegistry:(id<RCTTurboModuleRegistry> turboModuleRegistry);
707695
}
708696

709697
interface RCTBridgeModuleDecorator : public NSObject {

0 commit comments

Comments
 (0)