From 994ea3b44a34a012c0a4450db2a381707f9069dc Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Mon, 10 Mar 2025 11:05:39 -0700 Subject: [PATCH] Add missing loadFromSource method in the DefaultRNFactoryDelegate (#49931) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49931 This change fixes the app startup in the Old Architecture by implementing the loadSourceForBridge:onProgress:onComplete method in the RCTDefaultReactNativeFactoryDelegate object. The method was missing here, so the Bridge was never trying to load the JS bundle from Metro, resulting in an empty app. ## Changelog: [iOS][Fixed] - Implement the loadSourceForBridge:onProgress:onComplete in the RCTDefaultReactNativeFactoryDelegate. Reviewed By: cortinico Differential Revision: D70898811 fbshipit-source-id: 3e5d519a1965e92ace91ca6d5b316a9069279448 --- .../AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm | 7 +++++++ packages/rn-tester/RNTester/AppDelegate.mm | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm index 710f00e3142..737dcaf07d8 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm @@ -118,4 +118,11 @@ return nullptr; } +- (void)loadSourceForBridge:(RCTBridge *)bridge + onProgress:(RCTSourceLoadProgressBlock)onProgress + onComplete:(RCTSourceLoadBlock)loadCallback +{ + [RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback]; +} + @end diff --git a/packages/rn-tester/RNTester/AppDelegate.mm b/packages/rn-tester/RNTester/AppDelegate.mm index a2d0ac54605..20b45f36819 100644 --- a/packages/rn-tester/RNTester/AppDelegate.mm +++ b/packages/rn-tester/RNTester/AppDelegate.mm @@ -76,13 +76,6 @@ static NSString *kBundlePath = @"js/RNTesterApp.ios"; return [RCTLinkingManager application:app openURL:url options:options]; } -- (void)loadSourceForBridge:(RCTBridge *)bridge - onProgress:(RCTSourceLoadProgressBlock)onProgress - onComplete:(RCTSourceLoadBlock)loadCallback -{ - [RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback]; -} - - (std::shared_ptr)getTurboModule:(const std::string &)name jsInvoker:(std::shared_ptr)jsInvoker {