Reputation: 1517
in android\app\build.gradle:
project.ext.react = [
entryFile: "index.js",
enableHermes: false,
]
in index.js
console.log('hermes -> ishermes', global.HermesInternal !== null);
npm run android
in log:
Time Tag Message
18:28:15.576 ReactNativeJS 'hermes -> ishermes', true
why enableHermes: false but global.HermesInternal = {} ??
react-native: 0.61.5
Emulator
Upvotes: 1
Views: 3437
Reputation: 123500
JavaScript differentiates between null
and undefined
.
If Hermes is disabled, then HermesInternal
will be undefined
. It will not be null
.
To check if Hermes is enabled, you can use:
if (typeof(HermesInternal) === "undefined") {
console.log("Hermes is not enabled");
} else {
console.log("Hermes is enabled");
}
Upvotes: 6