diff --git a/HACKS.md b/HACKS.md
index cdc8d8ed2ed..bff7ebe6cd6 100644
--- a/HACKS.md
+++ b/HACKS.md
@@ -376,3 +376,13 @@ Once we have removed the `palette` directory from eigen.
#### Explanation/Context:
Look at the tech plan here: https://www.notion.so/artsy/palette-mobile-in-eigen-c5e3396302734f0a921aed3978f5dbeb
+
+## hermes
+
+#### When can we remove this:
+
+Once we update let's check if NativeModules in android hermes are working properly (not returning empty object `{}`)
+
+#### Explanation/Context:
+
+https://github.com/artsy/eigen/blob/9aae916dfba8cc25aaa7eacf165dda8578b08869/src/app/utils/DevMenu.tsx#L99
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 54dd324666e..7567a86294e 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -84,12 +84,6 @@ import com.android.build.OutputFile
* ]
*/
-project.ext.react = [
- enableHermes: false, // clean and rebuild if changing
-]
-
-apply from: "../../node_modules/react-native/react.gradle"
-
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
@@ -125,6 +119,14 @@ def jscFlavor = 'org.webkit:android-jsc-intl:+'
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
+
+// order matters here, this must be set before the react.gradle apply
+project.ext.react = [
+ entryFile: "index.android.js",
+ enableHermes: true
+]
+
+apply from: "../../node_modules/react-native/react.gradle"
def enableHermes = project.ext.react.get("enableHermes", false)
/**
diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro
index 11b025724a3..755609dd9c1 100644
--- a/android/app/proguard-rules.pro
+++ b/android/app/proguard-rules.pro
@@ -8,3 +8,7 @@
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
+
+# needed for hermes
+-keep class com.facebook.hermes.unicode.** { *; }
+-keep class com.facebook.jni.** { *; }
diff --git a/babel.config.js b/babel.config.js
index e45ab0ac2a5..c156cb25dd7 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -6,6 +6,7 @@ module.exports = (api) => {
return {
// plugins run first
plugins: [
+ "@babel/plugin-transform-named-capturing-groups-regex",
"@babel/plugin-transform-flow-strip-types",
["@babel/plugin-proposal-decorators", { version: "legacy" }],
["@babel/plugin-proposal-private-methods", { loose: true }], // needed for latest jest, must come after decorators
diff --git a/package.json b/package.json
index 6541d56c10d..e76f55b5c3b 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,9 @@
"scripts": {
"android": "react-native run-android",
"bundle:ios": "node --expose-gc --max_old_space_size=8192 ./node_modules/react-native/local-cli/cli.js bundle --platform=ios --dev=false --entry-file=index.tests.ios.js --bundle-output dist/main.jsbundle --sourcemap-output dist/main.jsbundle.map --assets-dest dist",
- "bundle:android": "NODE_OPTIONS=--max_old_space_size=8192 react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --sourcemap-output android/app/src/main/assets/index.android.bundle.map --assets-dest android/app/src/main/res",
+ "bundle:android": "yarn bundle:android:hermes && yarn bundle:hermes && yarn sourcemap-merge:android",
+ "bundle:android:hermes": "NODE_OPTIONS=--max_old_space_size=8192 react-native bundle --platform android --dev false --entry-file index.android.js --minify false --reset-cache --assets-dest android/app/src/main/res --bundle-output android/app/src/main/assets/index.android.bundle --sourcemap-output android/app/src/main/assets/index.android.bundle.packager.map",
+ "bundle:hermes": "NODE_OPTIONS=--max_old_space_size=8192 ./node_modules/hermes-engine/`node -e \"const platform=require('os').platform();console.log(platform === 'darwin' ? 'osx-bin' : (platform === 'linux' ? 'linux64-bin' : (platform === 'win32' ? 'win64-bin' : 'unsupported-os')));\"`/hermesc -O -emit-binary -output-source-map -out=android/app/src/main/assets/index.android.bundle.hbc android/app/src/main/assets/index.android.bundle && rm -f android/app/src/main/assets/index.android.bundle && mv android/app/src/main/assets/index.android.bundle.hbc android/app/src/main/assets/index.android.bundle",
"check-flags": "./scripts/check-flags/check-flags.js",
"ci": "yarn ci:type-check && yarn ci:lint && yarn prettier-project -l && rm -rf src/__generated__ && yarn relay && yarn ci:test",
"ci:lint": "yarn lint --format json --out eslint-errors.json",
@@ -56,6 +58,7 @@
"setup:artsy:update!": "scripts/update-env-for-artsy",
"setup:oss": "./scripts/setup-env-for-oss",
"setup:releases": "./scripts/setup-env-for-artsy && ./scripts/setup-distribute-macos",
+ "sourcemap-merge:android": "NODE_OPTIONS=--max_old_space_size=8192 node ./node_modules/react-native/scripts/compose-source-maps.js android/app/src/main/assets/index.android.bundle.packager.map android/app/src/main/assets/index.android.bundle.hbc.map -o android/app/src/main/assets/index.android.bundle.map",
"start": "concurrently --kill-others -n relay,metro 'yarn relay --watch' 'yarn react-native start'",
"start-storybook": "STORYBOOK=1 yarn start",
"start:reset-cache": "concurrently --kill-others -n relay,metro 'yarn relay --watch' 'yarn react-native start --reset-cache'",
@@ -136,6 +139,7 @@
"formik": "2.2.9",
"google-libphonenumber": "3.2.31",
"grapheme-splitter": "1.0.4",
+ "hermes-engine": "0.10.0",
"html-entities": "2.3.3",
"jsc-android": "250230.2.1",
"limiter": "^2.1.0",
@@ -212,6 +216,7 @@
"@babel/core": "7.16.12",
"@babel/plugin-proposal-decorators": "7.18.9",
"@babel/plugin-transform-flow-strip-types": "7.18.9",
+ "@babel/plugin-transform-named-capturing-groups-regex": "7.20.5",
"@babel/preset-env": "7.18.9",
"@babel/preset-react": "7.18.6",
"@babel/preset-typescript": "7.18.6",
diff --git a/src/app/utils/DevMenu.tsx b/src/app/utils/DevMenu.tsx
index 32860e33591..f446d0447fe 100644
--- a/src/app/utils/DevMenu.tsx
+++ b/src/app/utils/DevMenu.tsx
@@ -99,7 +99,10 @@ export const DevMenu = ({ onClose = () => dismissModal() }: { onClose(): void })
{userEmail}
- NativeModules.DevMenu.show()} />
+ NativeModules?.DevMenu?.show?.()}
+ />