@@ -13,7 +13,6 @@ import {
1313} from "react-native" ;
1414// @ts -expect-error no type definitions available
1515import { version as coreVersion } from "react-native/Libraries/Core/ReactNativeVersion" ;
16- import { Colors , Header } from "react-native/Libraries/NewAppScreen" ;
1716
1817declare global {
1918 export const RN$Bridgeless : boolean ;
@@ -32,14 +31,38 @@ type FeatureProps =
3231 onValueChange ?: ( value : boolean ) => void ;
3332 } ;
3433
34+ // https://github.com/facebook/react-native/blob/0abd5d63e1c0c4708f81bd698e6d011fa75f01e5/packages/new-app-screen/src/Theme.js#L16-L33
35+ const COLORS = {
36+ light : {
37+ background : "#f3f3f3" ,
38+ backgroundHighlight : "#cfe6ee" ,
39+ cardBackground : "#fff" ,
40+ cardOutline : "#dae1e7" ,
41+ textPrimary : "#000" ,
42+ textSecondary : "#404756" ,
43+ } ,
44+ dark : {
45+ background : "#000" ,
46+ backgroundHighlight : "#193c47" ,
47+ cardBackground : "#222" ,
48+ cardOutline : "#444" ,
49+ textPrimary : "#fff" ,
50+ textSecondary : "#c0c1c4" ,
51+ } ,
52+ } ;
53+
3554function getHermesVersion ( ) : string | undefined {
36- return (
55+ const version =
3756 "HermesInternal" in global &&
3857 HermesInternal &&
3958 "getRuntimeProperties" in HermesInternal &&
4059 typeof HermesInternal . getRuntimeProperties === "function" &&
41- HermesInternal . getRuntimeProperties ( ) [ "OSS Release Version" ]
42- ) ;
60+ HermesInternal . getRuntimeProperties ( ) [ "OSS Release Version" ] ;
61+ if ( ! version ) {
62+ return undefined ;
63+ }
64+
65+ return `Hermes ${ version } ` ;
4366}
4467
4568function getReactNativeVersion ( ) : string {
@@ -118,19 +141,19 @@ function useLocalStorageStatus() {
118141function useStyles ( ) {
119142 const colorScheme = useColorScheme ( ) ;
120143 return useMemo ( ( ) => {
121- const isDarkMode = colorScheme === "dark" ;
144+ const colors = COLORS [ colorScheme ?? "light" ] ;
122145
123146 const fontSize = 18 ;
124147 const groupBorderRadius = 8 ;
125148 const margin = 16 ;
126149
127150 return StyleSheet . create ( {
128151 body : {
129- backgroundColor : isDarkMode ? Colors . black : Colors . lighter ,
152+ backgroundColor : colors . background ,
130153 flex : 1 ,
131154 } ,
132155 group : {
133- backgroundColor : isDarkMode ? Colors . darker : Colors . white ,
156+ backgroundColor : colors . cardBackground ,
134157 borderRadius : groupBorderRadius ,
135158 margin,
136159 } ,
@@ -140,21 +163,29 @@ function useStyles() {
140163 paddingHorizontal : margin ,
141164 } ,
142165 groupItemLabel : {
143- color : isDarkMode ? Colors . white : Colors . black ,
166+ color : colors . textPrimary ,
144167 flex : 1 ,
145168 fontSize,
146169 marginVertical : 12 ,
147170 } ,
148171 groupItemValue : {
149- color : isDarkMode ? Colors . light : Colors . dark ,
172+ color : colors . textSecondary ,
150173 fontSize : fontSize ,
151174 textAlign : "right" ,
152175 } ,
153176 separator : {
154- backgroundColor : isDarkMode ? Colors . dark : Colors . light ,
177+ backgroundColor : colors . cardOutline ,
155178 height : StyleSheet . hairlineWidth ,
156179 marginStart : margin ,
157180 } ,
181+ title : {
182+ fontSize : 40 ,
183+ fontWeight : "700" ,
184+ paddingTop : 64 ,
185+ paddingHorizontal : 32 ,
186+ paddingBottom : 40 ,
187+ textAlign : "center" ,
188+ } ,
158189 } ) ;
159190 } , [ colorScheme ] ) ;
160191}
@@ -225,15 +256,15 @@ export function App(props: AppProps): React.ReactElement<AppProps> {
225256 onLayout = { setIsFabric }
226257 style = { styles . body }
227258 >
228- < Header / >
259+ < Text style = { styles . title } > Welcome to React Native </ Text >
229260 < DevMenu />
230261 < View style = { styles . group } >
231262 < Feature value = { localStorageStatus } > window.localStorage</ Feature >
232263 </ View >
233264 < View style = { styles . group } >
234265 < Feature value = { getReactNativeVersion ( ) } > React Native</ Feature >
235266 < Separator />
236- < Feature value = { isOnOrOff ( getHermesVersion ( ) ) } > Hermes </ Feature >
267+ < Feature value = { getHermesVersion ( ) ?? "JSC" } > JS Engine </ Feature >
237268 < Separator />
238269 < Feature value = { isOnOrOff ( isFabric ) } > Fabric</ Feature >
239270 < Separator />
0 commit comments