diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm index a6fcb509476..808c315c2f1 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm @@ -134,10 +134,10 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot"; return YES; } +#if RCT_NEW_ARCH_ENABLED #pragma mark - RCTCxxBridgeDelegate - (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge { -#if RCT_NEW_ARCH_ENABLED _runtimeScheduler = std::make_shared(RCTRuntimeExecutorFromBridge(bridge)); std::shared_ptr callInvoker = std::make_shared(_runtimeScheduler); @@ -147,12 +147,6 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot"; _contextContainer->erase("RuntimeScheduler"); _contextContainer->insert("RuntimeScheduler", _runtimeScheduler); return RCTAppSetupDefaultJsExecutorFactory(bridge, turboModuleManager, _runtimeScheduler); -#else - if (self.runtimeSchedulerEnabled) { - _runtimeScheduler = std::make_shared(RCTRuntimeExecutorFromBridge(bridge)); - } - return RCTAppSetupJsExecutorFactoryForOldArch(bridge, _runtimeScheduler); -#endif } #pragma mark - RCTTurboModuleManagerDelegate diff --git a/packages/react-native/ReactCommon/React-Fabric.podspec b/packages/react-native/ReactCommon/React-Fabric.podspec index 9ad649073b3..50c8a741685 100644 --- a/packages/react-native/ReactCommon/React-Fabric.podspec +++ b/packages/react-native/ReactCommon/React-Fabric.podspec @@ -51,9 +51,9 @@ Pod::Spec.new do |s| s.dependency "glog" s.dependency "DoubleConversion" s.dependency "React-Core" - s.dependency "React-debug" - s.dependency "React-utils" - s.dependency "React-runtimescheduler" + # s.dependency "React-debug" + # s.dependency "React-utils" + # s.dependency "React-runtimescheduler" s.dependency "React-cxxreact" if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1" diff --git a/packages/rn-tester/RNTester/AppDelegate.mm b/packages/rn-tester/RNTester/AppDelegate.mm index d9a5e3ff6cb..f4e8d4006c5 100644 --- a/packages/rn-tester/RNTester/AppDelegate.mm +++ b/packages/rn-tester/RNTester/AppDelegate.mm @@ -9,69 +9,18 @@ #import #import -#import -#import -#import #import #import -#import - #if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC #import #endif -#ifdef RN_FABRIC_ENABLED -#import -#import -#import -#import - -#import -#import -#import -#import -#import -#endif - #if RCT_NEW_ARCH_ENABLED #import #import #endif -#if DEBUG -#ifdef FB_SONARKIT_ENABLED -#import -#import -#import -#import -#import -#import -#import -#endif -#endif - -#import -#import "RNTesterTurboModuleProvider.h" - -@interface AppDelegate () { -#ifdef RN_FABRIC_ENABLED - RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; - std::shared_ptr _reactNativeConfig; - facebook::react::ContextContainer::Shared _contextContainer; - std::shared_ptr _runtimeScheduler; -#endif -} -@end - -#if RCT_NEW_ARCH_ENABLED -/// Declare conformance to `RCTComponentViewFactoryComponentProvider` -@interface AppDelegate () -@end -#endif - -static NSString *const kRNConcurrentRoot = @"concurrentRoot"; - @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions @@ -115,67 +64,6 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot"; [RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback]; } -#pragma mark - RCTCxxBridgeDelegate - -// This function is called during -// `[[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];` -- (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge -{ - std::shared_ptr callInvoker = bridge.jsCallInvoker; - -#ifdef RN_FABRIC_ENABLED - _runtimeScheduler = std::make_shared(RCTRuntimeExecutorFromBridge(bridge)); - _contextContainer->erase("RuntimeScheduler"); - _contextContainer->insert("RuntimeScheduler", _runtimeScheduler); - callInvoker = std::make_shared(_runtimeScheduler); -#endif - - RCTTurboModuleManager *turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge - delegate:self - jsInvoker:callInvoker]; - [bridge setRCTTurboModuleRegistry:turboModuleManager]; - -#if RCT_DEV - /** - * Eagerly initialize RCTDevMenu so CMD + d, CMD + i, and CMD + r work. - * This is a stop gap until we have a system to eagerly init Turbo Modules. - */ - [turboModuleManager moduleForName:"RCTDevMenu"]; -#endif - - __weak __typeof(self) weakSelf = self; - -#if RCT_USE_HERMES - return std::make_unique( -#else - return std::make_unique( -#endif - facebook::react::RCTJSIExecutorRuntimeInstaller([weakSelf, bridge, turboModuleManager]( - facebook::jsi::Runtime &runtime) { - if (!bridge) { - return; - } - -#if RN_FABRIC_ENABLED - __typeof(self) strongSelf = weakSelf; - if (strongSelf && strongSelf->_runtimeScheduler) { - facebook::react::RuntimeSchedulerBinding::createAndInstallIfNeeded(runtime, strongSelf->_runtimeScheduler); - } -#endif - - facebook::react::RuntimeExecutor syncRuntimeExecutor = - [&](std::function &&callback) { callback(runtime); }; - [turboModuleManager installJSBindingWithRuntimeExecutor:syncRuntimeExecutor]; - })); -} - -#pragma mark - RCTTurboModuleManagerDelegate - -- (Class)getModuleClassFromName:(const char *)name -{ - return facebook::react::RNTesterTurboModuleClassProvider(name); -} - - (std::shared_ptr)getTurboModule:(const std::string &)name jsInvoker:(std::shared_ptr)jsInvoker {