Delete dead sourceURLForBridge delegate chain (#59452)

Summary:

`sourceURLForBridge:` has no callers: the factory reads `bundleURL` directly, and the default delegate's implementations only threw or forwarded to each other. Delete the protocol method with those implementations and the factory's dead configuration assignment. The `RCTJavaScriptLoader.h` import stays: removing it breaks every `RCTBridge.h` importer that uses the loader types.

Changelog:
[iOS][Removed] - Remove deprecated `RCTBridgeDelegate` `sourceURLForBridge:`

Reviewed By: javache

Differential Revision: D127294778

Pull Request resolved: https://github.com/react/react-native/pull/59452
This commit is contained in:
Christoph Purrer authored and GitHub committed 2026-10-27 16:09:43 +00:00
1 parent f754dbd20a
commit 34795cbc36
8 files changed
+1 -38

No files matched your search

@@ -26,13 +26,6 @@
@synthesize dependencyProvider;
- (NSURL *_Nullable)sourceURLForBridge:(nonnull RCTBridge *)bridge
{
[NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"
format:@"Subclasses must implement a valid sourceURLForBridge method"];
return nil;
}
- (UIViewController *)createRootViewController
{
return [UIViewController new];
@@ -126,11 +119,4 @@
return nullptr;
}
- (void)loadSourceForBridge:(RCTBridge *)bridge
onProgress:(RCTSourceLoadProgressBlock)onProgress
onComplete:(RCTSourceLoadBlock)loadCallback
{
[RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback];
}
@end
@@ -295,11 +295,6 @@ static NSDictionary *RCTConvertConnectionOptionsToLaunchOptions(UISceneConnectio
[weakSelf.delegate customizeRootView:(RCTRootView *)rootView];
};
configuration.sourceURLForBridge = ^NSURL *_Nullable(RCTBridge *_Nonnull bridge)
{
return [weakSelf.delegate bundleURL];
};
if ([self.delegate respondsToSelector:@selector(extraModulesForBridge:)]) {
configuration.extraModulesForBridge = ^NSArray<id<RCTBridgeModule>> *_Nonnull(RCTBridge *_Nonnull bridge)
{
@@ -6,6 +6,7 @@
*/
#import <React/RCTBridge.h>
#import <React/RCTJavaScriptLoader.h>
#import <React/RCTRootView.h>
#import <React/RCTUtils.h>
#import "RCTJSRuntimeConfiguratorProtocol.h"
@@ -13,17 +13,6 @@
NS_ASSUME_NONNULL_BEGIN
@protocol RCTBridgeDelegate <NSObject>
#ifndef RCT_REMOVE_LEGACY_ARCH
/**
* The location of the JavaScript source file. When running from the packager
* this should be an absolute URL, e.g. `http://localhost:8081/index.ios.bundle`.
* When running from a locally bundled JS file, this should be a `file://` url
* pointing to a path inside the app resources, e.g. `file://.../main.jsbundle`.
*/
- (NSURL *__nullable)sourceURLForBridge:(RCTBridge *)bridge
__deprecated_msg("This API will be removed along with the legacy architecture.");
#endif
@end
NS_ASSUME_NONNULL_END
@@ -89,11 +89,6 @@ static NSString *const kBundlePath = @"js/RNTesterApp.ios";
[RCTLinkingManager scene:scene continueUserActivity:userActivity];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
return [self bundleURL];
}
- (NSURL *)bundleURL
{
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:kBundlePath];
@@ -2525,7 +2525,6 @@ protocol RCTBackedTextInputViewProtocol : public UITextInput {
}
protocol RCTBridgeDelegate : public NSObject {
public virtual NSURL* _Nullable sourceURLForBridge:(RCTBridge* bridge);
}
protocol RCTBridgeMethod : public NSObject {
@@ -2583,7 +2583,6 @@ protocol RCTBackedTextInputViewProtocol : public UITextInput {
}
protocol RCTBridgeDelegate : public NSObject {
public virtual NSURL* _Nullable sourceURLForBridge:(RCTBridge* bridge);
}
protocol RCTBridgeMethod : public NSObject {
@@ -2525,7 +2525,6 @@ protocol RCTBackedTextInputViewProtocol : public UITextInput {
}
protocol RCTBridgeDelegate : public NSObject {
public virtual NSURL* _Nullable sourceURLForBridge:(RCTBridge* bridge);
}
protocol RCTBridgeMethod : public NSObject {