Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/react-native-host/ReactNativeHost.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ repo_dir = repository['directory']

new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
preprocessor_definitions = [
'$(inherit)',
'$(inherited)',
"USE_HERMES=#{ENV['USE_HERMES'] || '0'}",
"USE_THIRD_PARTY_JSC=#{ENV['USE_THIRD_PARTY_JSC'] || '0'}",
"USE_V8=#{ENV['USE_V8'] || '0'}",
]
if new_arch_enabled
preprocessor_definitions << 'RCT_NEW_ARCH_ENABLED=1'
Expand Down Expand Up @@ -49,6 +51,7 @@ Pod::Spec.new do |s|
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++20',
'DEFINES_MODULE' => 'YES',
'GCC_PREPROCESSOR_DEFINITIONS' => preprocessor_definitions,
'CPP_PREPROCESSOR_DEFINITIONS' => preprocessor_definitions,
'HEADER_SEARCH_PATHS' => [
'$(PODS_ROOT)/Headers/Private/React-Core',
'$(PODS_CONFIGURATION_BUILD_DIR)/React-RuntimeApple/React_RuntimeApple.framework/Headers',
Expand Down
6 changes: 5 additions & 1 deletion packages/react-native-host/cocoa/RNXBridgelessHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@

#if USE_HERMES
#import <ReactCommon/RCTHermesInstance.h>
#elif USE_V8
#import <v8runtime/V8ExecutorFactory.h>
#elif __has_include(<React-jsc/RCTJscInstance.h>)
#import <React-jsc/RCTJscInstance.h>
#else
#import <ReactCommon/RCTJscInstance.h>
#import <ReactCommon/RCTJscInstance.h> // RN pre 0.80
#endif // USE_HERMES

#ifdef USE_REACT_NATIVE_CONFIG
Expand Down
12 changes: 7 additions & 5 deletions packages/react-native-host/cocoa/ReactNativeHost.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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<facebook::react::RCTHermesInstance>(config, nullptr);
#else
#else
return std::make_shared<facebook::react::RCTHermesInstance>(nullptr, false);
#endif // USE_REACT_NATIVE_CONFIG
#else // USE_HERMES
#endif // USE_REACT_NATIVE_CONFIG
#elif USE_V8
return std::make_shared<facebook::react::V8ExecutorFactory>();
#else
return std::make_shared<facebook::react::RCTJscInstance>();
#endif // USE_HERMES
#endif
};

__weak __typeof(self) weakSelf = self;
Expand Down
Loading