Skip to content

Commit 5892ad4

Browse files
christophpurrermeta-codesync[bot]
authored andcommitted
Deprecate unread factory config blocks, delete loadSourceForBridge (#59439)
Summary: Pull Request resolved: #59439 Seven bridge-related factory configuration blocks are written but never read. Mark them deprecated since external clients still set them, and delete the eighth (`loadSourceForBridge`), which has no writers at all. Also remove our own dead write and the only reader method. Changelog: [Internal] Differential Revision: D127294779
1 parent 4862816 commit 5892ad4

7 files changed

Lines changed: 15 additions & 33 deletions

File tree

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,6 @@ - (RCTRootViewFactory *)createRCTRootViewFactory
295295
[weakSelf.delegate customizeRootView:(RCTRootView *)rootView];
296296
};
297297

298-
if ([self.delegate respondsToSelector:@selector(extraModulesForBridge:)]) {
299-
configuration.extraModulesForBridge = ^NSArray<id<RCTBridgeModule>> *_Nonnull(RCTBridge *_Nonnull bridge)
300-
{
301-
return [weakSelf.delegate extraModulesForBridge:bridge];
302-
};
303-
}
304-
305298
configuration.jsRuntimeConfiguratorDelegate = self;
306299

307300
return [[RCTRootViewFactory alloc] initWithTurboModuleDelegate:self hostDelegate:self configuration:configuration];

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

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ typedef void (^RCTLoadSourceForBridgeWithProgressBlock)(
3939
RCTBridge *bridge,
4040
RCTSourceLoadProgressBlock onProgress,
4141
RCTSourceLoadBlock loadCallback);
42-
typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBlock loadCallback);
4342

4443
#pragma mark - RCTRootViewFactory Configuration
4544
@interface RCTRootViewFactoryConfiguration : NSObject
@@ -74,7 +73,8 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
7473
*
7574
* @returns: a UIView properly configured with a bridge for React Native.
7675
*/
77-
@property (nonatomic, nullable) RCTCreateRootViewWithBridgeBlock createRootViewWithBridge;
76+
@property (nonatomic, nullable) RCTCreateRootViewWithBridgeBlock createRootViewWithBridge __deprecated_msg(
77+
"This API will be removed along with the legacy architecture.");
7878

7979
/**
8080
* Block that allows to override default behavior of creating bridge.
@@ -87,7 +87,8 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
8787
*
8888
* @returns: a newly created instance of RCTBridge.
8989
*/
90-
@property (nonatomic, nullable) RCTCreateBridgeWithDelegateBlock createBridgeWithDelegate;
90+
@property (nonatomic, nullable) RCTCreateBridgeWithDelegateBlock createBridgeWithDelegate __deprecated_msg(
91+
"This API will be removed along with the legacy architecture.");
9192

9293
/**
9394
* Block that allows to customize the rootView that is passed to React Native.
@@ -106,7 +107,8 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
106107
* When running from a locally bundled JS file, this should be a `file://` url
107108
* pointing to a path inside the app resources, e.g. `file://.../main.jsbundle`.
108109
*/
109-
@property (nonatomic, nullable) RCTSourceURLForBridgeBlock sourceURLForBridge;
110+
@property (nonatomic, nullable) RCTSourceURLForBridgeBlock sourceURLForBridge __deprecated_msg(
111+
"This API will be removed along with the legacy architecture.");
110112

111113
/**
112114
* The bridge initializes any registered RCTBridgeModules automatically, however
@@ -122,12 +124,14 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
122124
* not recommended in most cases - if the module methods and behavior do not
123125
* match exactly, it may lead to bugs or crashes.
124126
*/
125-
@property (nonatomic, nullable) RCTExtraModulesForBridgeBlock extraModulesForBridge;
127+
@property (nonatomic, nullable) RCTExtraModulesForBridgeBlock extraModulesForBridge __deprecated_msg(
128+
"This API will be removed along with the legacy architecture.");
126129

127130
/**
128131
* Retrieve the list of lazy-native-modules names for the given bridge.
129132
*/
130-
@property (nonatomic, nullable) RCTExtraLazyModuleClassesForBridge extraLazyModuleClassesForBridge;
133+
@property (nonatomic, nullable) RCTExtraLazyModuleClassesForBridge extraLazyModuleClassesForBridge __deprecated_msg(
134+
"This API will be removed along with the legacy architecture.");
131135

132136
/**
133137
* The bridge will call this block when a module has been called from JS
@@ -136,20 +140,17 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
136140
* in the implementation, and the system must attempt to look for it again among registered.
137141
* If the module was not registered, return NO to prevent further searches.
138142
*/
139-
@property (nonatomic, nullable) RCTBridgeDidNotFindModuleBlock bridgeDidNotFindModule;
143+
@property (nonatomic, nullable) RCTBridgeDidNotFindModuleBlock bridgeDidNotFindModule __deprecated_msg(
144+
"This API will be removed along with the legacy architecture.");
140145

141146
/**
142147
* The bridge will automatically attempt to load the JS source code from the
143148
* location specified by the `sourceURLForBridge:` method, however, if you want
144149
* to handle loading the JS yourself, you can do so by setting this property.
145150
*/
146-
@property (nonatomic, nullable) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress;
147-
148-
/**
149-
* Similar to loadSourceForBridgeWithProgress but without progress
150-
* reporting.
151-
*/
152-
@property (nonatomic, nullable) RCTLoadSourceForBridgeBlock loadSourceForBridge;
151+
@property (nonatomic, nullable)
152+
RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress __deprecated_msg(
153+
"This API will be removed along with the legacy architecture.");
153154

154155
@end
155156

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,6 @@ - (RCTHost *)createReactHost:(NSDictionary *)launchOptions
229229
reinterpret_cast<facebook::react::JSRuntimeFactory *>(jsRuntimeFactory), &js_runtime_factory_destroy);
230230
}
231231

232-
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
233-
{
234-
if (_configuration.extraModulesForBridge != nil) {
235-
return _configuration.extraModulesForBridge(bridge);
236-
}
237-
return nil;
238-
}
239-
240232
- (NSURL *)bundleURL
241233
{
242234
return self->_configuration.bundleURLBlock();

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,6 @@ interface RCTRootViewFactoryConfiguration : public NSObject {
15851585
public @property (assign) RCTCustomizeRootViewBlock customizeRootView;
15861586
public @property (assign) RCTExtraLazyModuleClassesForBridge extraLazyModuleClassesForBridge;
15871587
public @property (assign) RCTExtraModulesForBridgeBlock extraModulesForBridge;
1588-
public @property (assign) RCTLoadSourceForBridgeBlock loadSourceForBridge;
15891588
public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress;
15901589
public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge;
15911590
public @property (weak) id<RCTJSRuntimeConfiguratorProtocol> jsRuntimeConfiguratorDelegate;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,6 @@ interface RCTRootViewFactoryConfiguration : public NSObject {
16281628
public @property (assign) RCTCustomizeRootViewBlock customizeRootView;
16291629
public @property (assign) RCTExtraLazyModuleClassesForBridge extraLazyModuleClassesForBridge;
16301630
public @property (assign) RCTExtraModulesForBridgeBlock extraModulesForBridge;
1631-
public @property (assign) RCTLoadSourceForBridgeBlock loadSourceForBridge;
16321631
public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress;
16331632
public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge;
16341633
public @property (weak) id<RCTJSRuntimeConfiguratorProtocol> jsRuntimeConfiguratorDelegate;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,6 @@ interface RCTRootViewFactoryConfiguration : public NSObject {
15841584
public @property (assign) RCTCustomizeRootViewBlock customizeRootView;
15851585
public @property (assign) RCTExtraLazyModuleClassesForBridge extraLazyModuleClassesForBridge;
15861586
public @property (assign) RCTExtraModulesForBridgeBlock extraModulesForBridge;
1587-
public @property (assign) RCTLoadSourceForBridgeBlock loadSourceForBridge;
15881587
public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress;
15891588
public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge;
15901589
public @property (weak) id<RCTJSRuntimeConfiguratorProtocol> jsRuntimeConfiguratorDelegate;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,6 @@ interface RCTRootViewFactoryConfiguration : public NSObject {
15851585
public @property (assign) RCTCustomizeRootViewBlock customizeRootView;
15861586
public @property (assign) RCTExtraLazyModuleClassesForBridge extraLazyModuleClassesForBridge;
15871587
public @property (assign) RCTExtraModulesForBridgeBlock extraModulesForBridge;
1588-
public @property (assign) RCTLoadSourceForBridgeBlock loadSourceForBridge;
15891588
public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress;
15901589
public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge;
15911590
public @property (weak) id<RCTJSRuntimeConfiguratorProtocol> jsRuntimeConfiguratorDelegate;

0 commit comments

Comments
 (0)