From fdbfc4abc010d08a2445f25fb4182667444039f9 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Thu, 5 Oct 2023 00:01:44 -0700 Subject: [PATCH] Add BUCK configuration for RNTester-iOS for NEW Arch (#39825) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39825 Changelog: [Internal] Reviewed By: fkgozali Differential Revision: D49834561 fbshipit-source-id: 1721e9f7954b40b620f6c2005fe6924589bfa245 --- .../Libraries/AppDelegate/RCTAppDelegate.mm | 8 ++++++++ .../Libraries/AppDelegate/RCTAppSetupUtils.h | 13 ++++++------- .../Libraries/AppDelegate/RCTAppSetupUtils.mm | 1 - packages/rn-tester/RNTester/AppDelegate.mm | 4 ++++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm index d666fe31c10..348355bae35 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm @@ -14,7 +14,11 @@ #import "RCTLegacyInteropComponents.h" #if RCT_NEW_ARCH_ENABLED +#if RN_DISABLE_OSS_PLUGIN_HEADER +#import +#else #import +#endif #import #import #import @@ -219,7 +223,11 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot"; - (Class)getModuleClassFromName:(const char *)name { +#if RN_DISABLE_OSS_PLUGIN_HEADER + return RCTTurboModulePluginClassProvider(name); +#else return RCTCoreModulesClassProvider(name); +#endif } - (std::shared_ptr)getTurboModule:(const std::string &)name diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h index 93bb40d8bde..e1c69078409 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h +++ b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h @@ -14,19 +14,18 @@ #import #ifndef RCT_USE_HERMES -#if __has_include() +#if __has_include() +#import +#define RCT_USE_HERMES 1 +#elif __has_include() +#import #define RCT_USE_HERMES 1 #else +#import #define RCT_USE_HERMES 0 #endif #endif -#if RCT_USE_HERMES -#import -#else -#import -#endif - #if RCT_NEW_ARCH_ENABLED #import #endif diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm index bb47fc10a47..4d69042a7d4 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm @@ -13,7 +13,6 @@ #if RCT_NEW_ARCH_ENABLED // Turbo Module -#import #import #import #import diff --git a/packages/rn-tester/RNTester/AppDelegate.mm b/packages/rn-tester/RNTester/AppDelegate.mm index fdeab2d7268..1bf36697556 100644 --- a/packages/rn-tester/RNTester/AppDelegate.mm +++ b/packages/rn-tester/RNTester/AppDelegate.mm @@ -18,8 +18,10 @@ #if RCT_NEW_ARCH_ENABLED #import +#ifndef RN_DISABLE_OSS_PLUGIN_HEADER #import #endif +#endif #if BUNDLE_PATH NSString *kBundlePath = @"xplat/js/RKJSModules/EntryPoints/RNTesterTestBundle.js"; @@ -125,10 +127,12 @@ NSString *kBundlePath = @"js/RNTesterApp.ios"; #pragma mark - RCTComponentViewFactoryComponentProvider #if RCT_NEW_ARCH_ENABLED +#ifndef RN_DISABLE_OSS_PLUGIN_HEADER - (nonnull NSDictionary> *)thirdPartyFabricComponents { return @{@"RNTMyNativeView" : RNTMyNativeViewComponentView.class}; } +#endif - (NSURL *)getBundleURL {