From c54aeccf1a8e16240e400d783dda5ec07fcf3808 Mon Sep 17 00:00:00 2001 From: Xuan Huang Date: Thu, 29 Apr 2021 17:07:58 -0700 Subject: [PATCH] Reflect Hermes release version from HermesBadge Summary: Changelog: [General] - Reflect Hermes release version from HermesBadge It was a common footgun that an unexpected version of Hermes engine is used in a RN app. To help with indicating this from the runtime, Hermes exposes its OSS release version from `HermesInternal.getRuntimeProperties()` Starting from 0.8.0. This diff updates the `HermesBadge` used by `NewAppScreen` header to reflect the version. Reviewed By: nadiia Differential Revision: D24436609 fbshipit-source-id: 8ba45be598a7d5af0e38f5044f9370fc7e1eb9a1 --- Libraries/NewAppScreen/components/HermesBadge.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Libraries/NewAppScreen/components/HermesBadge.js b/Libraries/NewAppScreen/components/HermesBadge.js index aa02f3a9881455..b0907266e02406 100644 --- a/Libraries/NewAppScreen/components/HermesBadge.js +++ b/Libraries/NewAppScreen/components/HermesBadge.js @@ -15,6 +15,9 @@ import Colors from './Colors'; const HermesBadge = (): Node => { const isDarkMode = useColorScheme() === 'dark'; + const version = + global.HermesInternal?.getRuntimeProperties?.()['OSS Release Version'] ?? + ''; return global.HermesInternal ? ( { color: isDarkMode ? Colors.light : Colors.dark, }, ]}> - Engine: Hermes + {`Engine: Hermes ${version}`} ) : null;