Skip to content

Commit

Permalink
RNTester-ios / RCTAppDelegate > correctly check for USE_HERMES Flag (#…
Browse files Browse the repository at this point in the history
…41573)

Summary:
Pull Request resolved: #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
  • Loading branch information
christophpurrer authored and facebook-github-bot committed Nov 21, 2023
1 parent b4d4aef commit e364553
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -305,7 +305,7 @@ - (void)createReactHost

- (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>();
Expand Down

0 comments on commit e364553

Please sign in to comment.