This repository was archived by the owner on Dec 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
63 lines (59 loc) · 1.73 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React from 'react'
import { useColorScheme } from 'react-native'
import { NavigationContainer } from '@react-navigation/native'
import { enableScreens } from 'react-native-screens'
import { createNativeStackNavigator } from '@react-navigation/native-stack'
import Home from './screens/Home'
import Detail from './screens/Detail'
enableScreens()
const Stack = createNativeStackNavigator()
export default function App() {
const theme = useColorScheme()
return (
<NavigationContainer>
<Stack.Navigator
theme={theme}
initialRouteName="Home"
screenOptions={{
headerStyle: {
backgroundColor: theme === 'light' ? '#fff' : '#3d3d3d',
},
headerTintColor: theme === 'light' ? '#000' : '#dedede',
headerTitleStyle: {
fontWeight: '300',
fontSize: 30,
},
}}
>
<Stack.Screen
name="Home"
component={Home}
options={{
title: 'Home',
headerBackTitle: null,
}}
initialParams={{ theme }}
/>
<Stack.Screen
name="Detail"
component={Detail}
options={({ route }) => ({
title: route.params.label,
headerBackTitle: '',
headerStyle: {
backgroundColor: route.params.color,
},
headerTitleStyle: {
color: 'black',
fontWeight: '300',
fontSize: 30,
},
// force left arrow to always be black no matter the theme (dark / light)
headerTintColor: '#000',
})}
initialParams={{ theme }}
/>
</Stack.Navigator>
</NavigationContainer>
)
}