RNTester-ios / RCTAppDelegate > correctly check for USE_HERMES Flag (#41573)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41573

Changelog: [iOS][Fixed] RNTester-ios / RCTAppDelegate > correctly check for USE_HERMES Flag

On iOS we check for ENV flags if Hermes should be used:
- https://github.com/facebook/react-native/blob/b4d4aef057ebf90176287f22d72b4b3b8b280c9a/packages/react-native/React-Core.podspec#L24
- https://github.com/facebook/react-native/blob/b4d4aef057ebf90176287f22d72b4b3b8b280c9a/packages/react-native/React/React-RCTFabric.podspec#L90

and add necessary C++ packages based on that flag.

In code we do check for those imports
https://github.com/facebook/react-native/blob/b4d4aef057ebf90176287f22d72b4b3b8b280c9a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h#L16-L27

and decided if we should use Hermes or not.

However the .mm check is faulty and does not check for the `RCT_USE_HERMES` flag set in code.

Reviewed By: fkgozali

Differential Revision: D51483740

fbshipit-source-id: 428c27aae80fe6f9799cf6ae21a5d3801fe6ca11
This commit is contained in:
Christoph Purrer
2023-11-20 16:25:46 -08:00
committed by Facebook GitHub Bot
parent b4d4aef057
commit e364553492
@@ -27,7 +27,7 @@
#import <React/RCTSurfaceHostingProxyRootView.h>
#import <React/RCTSurfacePresenter.h>
#import <ReactCommon/RCTContextContainerHandling.h>
#if USE_HERMES
#if RCT_USE_HERMES
#import <ReactCommon/RCTHermesInstance.h>
#else
#import <ReactCommon/RCTJscInstance.h>
@@ -305,7 +305,7 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
- (std::shared_ptr<facebook::react::JSEngineInstance>)createJSEngineInstance
{
#if USE_HERMES
#if RCT_USE_HERMES
return std::make_shared<facebook::react::RCTHermesInstance>(_reactNativeConfig, nullptr);
#else
return std::make_shared<facebook::react::RCTJscInstance>();