From d2c2187a3cdb785be4f9162cdbf31b54baac91b3 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 5 Nov 2025 13:10:45 -0800 Subject: [PATCH 01/10] fix community JSC support fix compile error in ReactNativeHost.mm when Hermes is not being used. `fatal error: 'ReactCommon/RCTHermesInstance.h' file not found` the USE_HERMES preprocessor definition was only being set in GCC_PREPROCESSOR_DEFINITIONS (for C and Objective-C files), but NOT in OTHER_CPLUSPLUSFLAGS (for [Objective] C++) files. this caused ReactNativeHost.mm to NOT received the USE_HERMES=0 flag, making it incorrectly import Hermes symbols that aren't resolved at link time. --- packages/react-native-host/ReactNativeHost.podspec | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/react-native-host/ReactNativeHost.podspec b/packages/react-native-host/ReactNativeHost.podspec index 08feac04d3..8849bad315 100644 --- a/packages/react-native-host/ReactNativeHost.podspec +++ b/packages/react-native-host/ReactNativeHost.podspec @@ -10,13 +10,20 @@ repo_dir = repository['directory'] new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1' preprocessor_definitions = [ - '$(inherit)', + '$(inherited)', "USE_HERMES=#{ENV['USE_HERMES'] || '0'}", ] +cxx_flags = [ + '$(inherited)', + "-DUSE_HERMES=#{ENV['USE_HERMES'] || '0'}", +] if new_arch_enabled preprocessor_definitions << 'RCT_NEW_ARCH_ENABLED=1' preprocessor_definitions << 'USE_FABRIC=1' preprocessor_definitions << 'USE_BRIDGELESS=1' if ENV['USE_BRIDGELESS'] == '1' + cxx_flags << '-DRCT_NEW_ARCH_ENABLED=1' + cxx_flags << 'USE_FABRIC=1' + cxx_flags << 'USE_BRIDGELESS=1' if ENV['USE_BRIDGELESS'] == '1' end Pod::Spec.new do |s| @@ -49,6 +56,7 @@ Pod::Spec.new do |s| 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++20', 'DEFINES_MODULE' => 'YES', 'GCC_PREPROCESSOR_DEFINITIONS' => preprocessor_definitions, + 'OTHER_CPLUSPLUSFLAGS' => cxx_flags.join(' '), 'HEADER_SEARCH_PATHS' => [ '$(PODS_ROOT)/Headers/Private/React-Core', '$(PODS_CONFIGURATION_BUILD_DIR)/React-RuntimeApple/React_RuntimeApple.framework/Headers', From b0a97705567543028877756a0366983de0bc2fab Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 5 Nov 2025 16:06:45 -0800 Subject: [PATCH 02/10] make it more congruent and generic try to avoid a rapid follow up PR for v8, and make things a little more congruent --- packages/react-native-host/ReactNativeHost.podspec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/react-native-host/ReactNativeHost.podspec b/packages/react-native-host/ReactNativeHost.podspec index 8849bad315..41c5d70b15 100644 --- a/packages/react-native-host/ReactNativeHost.podspec +++ b/packages/react-native-host/ReactNativeHost.podspec @@ -12,10 +12,14 @@ new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1' preprocessor_definitions = [ '$(inherited)', "USE_HERMES=#{ENV['USE_HERMES'] || '0'}", + "USE_THIRD_PARTY_JSC=#{ENV['USE_THIRD_PARTY_JSC'] || '0'}", + "USE_V8=#{ENV['USE_V8'] || '0'}", ] cxx_flags = [ '$(inherited)', "-DUSE_HERMES=#{ENV['USE_HERMES'] || '0'}", + "-DUSE_THIRD_PARTY_JSC=#{ENV['USE_THIRD_PARTY_JSC'] || '0'}", + "-DUSE_V8=#{ENV['USE_V8'] || '0'}", ] if new_arch_enabled preprocessor_definitions << 'RCT_NEW_ARCH_ENABLED=1' From 3e98d66a3409e67fda7ee223f4bd55e9bdae66a3 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 5 Nov 2025 18:57:31 -0800 Subject: [PATCH 03/10] Update import path for RCTJscInstance another conditional compile restoration. verified this works in my local branch of benchmark-test-app with RN 0.82 and @rnc/javascriptcore --- packages/react-native-host/cocoa/RNXBridgelessHeaders.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-native-host/cocoa/RNXBridgelessHeaders.h b/packages/react-native-host/cocoa/RNXBridgelessHeaders.h index bfa2129e11..0596daa819 100644 --- a/packages/react-native-host/cocoa/RNXBridgelessHeaders.h +++ b/packages/react-native-host/cocoa/RNXBridgelessHeaders.h @@ -8,8 +8,10 @@ #if USE_HERMES #import +#elif USE_V8 +#import #else -#import +#import #endif // USE_HERMES #ifdef USE_REACT_NATIVE_CONFIG From b31d7b4217c873d784b0e736899fabadbb615482 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 5 Nov 2025 19:04:25 -0800 Subject: [PATCH 04/10] Restore JSC and v8 support --- packages/react-native-host/cocoa/ReactNativeHost.mm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/react-native-host/cocoa/ReactNativeHost.mm b/packages/react-native-host/cocoa/ReactNativeHost.mm index 510805387d..b0c2d34111 100644 --- a/packages/react-native-host/cocoa/ReactNativeHost.mm +++ b/packages/react-native-host/cocoa/ReactNativeHost.mm @@ -289,16 +289,18 @@ - (void)initializeReactHost SharedJSRuntimeFactory (^jsEngineProvider)() = ^SharedJSRuntimeFactory { #if USE_HERMES -#ifdef USE_REACT_NATIVE_CONFIG + #ifdef USE_REACT_NATIVE_CONFIG auto config = reactNativeConfig.lock(); NSAssert(config, @"Expected nonnull ReactNativeConfig instance"); return std::make_shared(config, nullptr); -#else + #else return std::make_shared(nullptr, false); -#endif // USE_REACT_NATIVE_CONFIG -#else // USE_HERMES + #endif // USE_REACT_NATIVE_CONFIG +#elif USE_V8 + return std::make_shared(); +#else return std::make_shared(); -#endif // USE_HERMES +#endif }; __weak __typeof(self) weakSelf = self; From 86fb0fa2f2fc242b72c4bbd27ac66908afbf0fe7 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Thu, 6 Nov 2025 12:22:02 -0800 Subject: [PATCH 05/10] Update packages/react-native-host/ReactNativeHost.podspec Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com> --- packages/react-native-host/ReactNativeHost.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-host/ReactNativeHost.podspec b/packages/react-native-host/ReactNativeHost.podspec index 41c5d70b15..22880f16df 100644 --- a/packages/react-native-host/ReactNativeHost.podspec +++ b/packages/react-native-host/ReactNativeHost.podspec @@ -60,7 +60,7 @@ Pod::Spec.new do |s| 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++20', 'DEFINES_MODULE' => 'YES', 'GCC_PREPROCESSOR_DEFINITIONS' => preprocessor_definitions, - 'OTHER_CPLUSPLUSFLAGS' => cxx_flags.join(' '), + 'CPP_PREPROCESSOR_DEFINITIONS' => preprocessor_definitions, 'HEADER_SEARCH_PATHS' => [ '$(PODS_ROOT)/Headers/Private/React-Core', '$(PODS_CONFIGURATION_BUILD_DIR)/React-RuntimeApple/React_RuntimeApple.framework/Headers', From fe5ab4bde12a6003198dccd223cf3ea98a9c6cc3 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Thu, 6 Nov 2025 12:22:55 -0800 Subject: [PATCH 06/10] Update packages/react-native-host/ReactNativeHost.podspec Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com> --- packages/react-native-host/ReactNativeHost.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native-host/ReactNativeHost.podspec b/packages/react-native-host/ReactNativeHost.podspec index 22880f16df..ceb9e912d4 100644 --- a/packages/react-native-host/ReactNativeHost.podspec +++ b/packages/react-native-host/ReactNativeHost.podspec @@ -26,8 +26,8 @@ if new_arch_enabled preprocessor_definitions << 'USE_FABRIC=1' preprocessor_definitions << 'USE_BRIDGELESS=1' if ENV['USE_BRIDGELESS'] == '1' cxx_flags << '-DRCT_NEW_ARCH_ENABLED=1' - cxx_flags << 'USE_FABRIC=1' - cxx_flags << 'USE_BRIDGELESS=1' if ENV['USE_BRIDGELESS'] == '1' + cxx_flags << '-DUSE_FABRIC=1' + cxx_flags << '-DUSE_BRIDGELESS=1' if ENV['USE_BRIDGELESS'] == '1' end Pod::Spec.new do |s| From 7a72da47b43c9d508eebabaaadf7c11c92e5b531 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Thu, 6 Nov 2025 15:53:16 -0800 Subject: [PATCH 07/10] Add fallback import for RCTJscInstance.h --- packages/react-native-host/cocoa/RNXBridgelessHeaders.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react-native-host/cocoa/RNXBridgelessHeaders.h b/packages/react-native-host/cocoa/RNXBridgelessHeaders.h index 0596daa819..061c754601 100644 --- a/packages/react-native-host/cocoa/RNXBridgelessHeaders.h +++ b/packages/react-native-host/cocoa/RNXBridgelessHeaders.h @@ -10,10 +10,14 @@ #import #elif USE_V8 #import -#else +#elif __has_include() #import +#else +#import // RN pre 0.80 #endif // USE_HERMES + + #ifdef USE_REACT_NATIVE_CONFIG #import #endif // USE_REACT_NATIVE_CONFIG From 0f6f186e493bb8d56e593e3bc428c5664187d16c Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Sun, 9 Nov 2025 17:54:54 -0800 Subject: [PATCH 08/10] Update ReactNativeHost.podspec Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com> --- packages/react-native-host/ReactNativeHost.podspec | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/react-native-host/ReactNativeHost.podspec b/packages/react-native-host/ReactNativeHost.podspec index ceb9e912d4..a01f21f41e 100644 --- a/packages/react-native-host/ReactNativeHost.podspec +++ b/packages/react-native-host/ReactNativeHost.podspec @@ -15,12 +15,6 @@ preprocessor_definitions = [ "USE_THIRD_PARTY_JSC=#{ENV['USE_THIRD_PARTY_JSC'] || '0'}", "USE_V8=#{ENV['USE_V8'] || '0'}", ] -cxx_flags = [ - '$(inherited)', - "-DUSE_HERMES=#{ENV['USE_HERMES'] || '0'}", - "-DUSE_THIRD_PARTY_JSC=#{ENV['USE_THIRD_PARTY_JSC'] || '0'}", - "-DUSE_V8=#{ENV['USE_V8'] || '0'}", -] if new_arch_enabled preprocessor_definitions << 'RCT_NEW_ARCH_ENABLED=1' preprocessor_definitions << 'USE_FABRIC=1' From 7f38e9e415be7599707fa48767a654b261d7f343 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Sun, 9 Nov 2025 17:55:01 -0800 Subject: [PATCH 09/10] Update ReactNativeHost.podspec Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com> --- packages/react-native-host/ReactNativeHost.podspec | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/react-native-host/ReactNativeHost.podspec b/packages/react-native-host/ReactNativeHost.podspec index a01f21f41e..f3d572840e 100644 --- a/packages/react-native-host/ReactNativeHost.podspec +++ b/packages/react-native-host/ReactNativeHost.podspec @@ -19,9 +19,6 @@ if new_arch_enabled preprocessor_definitions << 'RCT_NEW_ARCH_ENABLED=1' preprocessor_definitions << 'USE_FABRIC=1' preprocessor_definitions << 'USE_BRIDGELESS=1' if ENV['USE_BRIDGELESS'] == '1' - cxx_flags << '-DRCT_NEW_ARCH_ENABLED=1' - cxx_flags << '-DUSE_FABRIC=1' - cxx_flags << '-DUSE_BRIDGELESS=1' if ENV['USE_BRIDGELESS'] == '1' end Pod::Spec.new do |s| From c6619e1a1361959d66e80bf540845c7bb135f6ab Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Sun, 9 Nov 2025 17:55:08 -0800 Subject: [PATCH 10/10] Update RNXBridgelessHeaders.h Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com> --- packages/react-native-host/cocoa/RNXBridgelessHeaders.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/react-native-host/cocoa/RNXBridgelessHeaders.h b/packages/react-native-host/cocoa/RNXBridgelessHeaders.h index 061c754601..fd3285c307 100644 --- a/packages/react-native-host/cocoa/RNXBridgelessHeaders.h +++ b/packages/react-native-host/cocoa/RNXBridgelessHeaders.h @@ -16,8 +16,6 @@ #import // RN pre 0.80 #endif // USE_HERMES - - #ifdef USE_REACT_NATIVE_CONFIG #import #endif // USE_REACT_NATIVE_CONFIG