mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
1c634a9218
Summary: Refs https://github.com/facebook/react-native/issues/28711 This PR moves Hermes badge component from the template to the `NewAppScreen` library. The main motivation behind this change was to simplify a bit template code. I assumed that it is not important to expose `global.HermesInternal` to the template users: * If this assumption is true, I think that there are no other reason to leave this component inside `App` in comparison to other `NewAppScreen` components, * If this assumption is false, I can adjust this PR and move `HermesInternal` check from the badge component to the `App`. I was trying to avoid calling `useColorScheme` when Hermes is disabled, but placing hook inside the conditional branch causes ESLint warning (react-hooks/rules-of-hooks). This PR includes also small style tweaks for the badge - since there are no background padding can be omitted and spacing can be added adjusted tweaking `top` and `left` properties and `fontSize` has been adjusted just for the readability. In the last commit, I have gone a bit further and moved `HermesBadge` to the `Header` component and I have also changed slightly the `Header` title (React -> React Native) and it's styling. > I'm not sure if after this change `HermesBadge` export in `NewAppScreen` components list is still required, but maybe this badge will be useful for someone. If it's a mistake I can update the PR and remove this export. ## Changelog [Internal][Changed] move Hermes badge from the template to the NewAppScreen library Pull Request resolved: https://github.com/facebook/react-native/pull/28783 Test Plan: Template app do not redbox on Android emulator with and without Hermes enabled. ## Preview Android with Hermes enabled and adjusted header:  iOS with adjusted header:  Reviewed By: GijsWeterings Differential Revision: D22493822 Pulled By: cpojer fbshipit-source-id: 3440e10f2d59f268ca8851a6e002f0ff23fa839c