DEV Community

loading...

Enable Hermes in React Native Project (>0.64)

ajmal_hasan profile image Ajmal Hasan Updated on ・1 min read

Hermes is an open-source JavaScript engine. For many apps, enabling Hermes will result in improved start-up time, decreased memory usage, and smaller app size. At this time Hermes is an opt-in React Native feature, and this guide explains how to enable it.

ANDROID:

Edit your android/app/build.gradle file and make the change illustrated below: This is applicable for React native version >0.62.

  project.ext.react = [
      entryFile: "index.js",
-     enableHermes: false  // clean and rebuild if changing
+     enableHermes: true  // clean and rebuild if changing
  ]
Enter fullscreen mode Exit fullscreen mode

Now rebuild the android project and you can see the changes.

iOS:
Hermes opt-in on iOS (Hermes support on iOS is still early stage)
This is applicable for React native version >0.64
To enable Hermes on iOS, set hermes_enabled to true in your Podfile and run pod install.

Replace:

  use_react_native!(:path => config["reactNativePath"])
Enter fullscreen mode Exit fullscreen mode

with:

use_react_native!(
   :path => config[:reactNativePath],
   # to enable hermes on iOS, change `false` to `true` and then install pods
   :hermes_enabled => true
)
Enter fullscreen mode Exit fullscreen mode

Discussion (0)

Forem Open with the Forem app