forked from ajsaraujo/my-health-app
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.tsx
72 lines (66 loc) · 2.05 KB
/
App.tsx
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
64
65
66
67
68
69
70
71
72
import { DefaultTheme, NavigationContainer } from '@react-navigation/native'
import {
createNativeStackNavigator,
NativeStackNavigationOptions,
} from '@react-navigation/native-stack'
import { MyHealthModule } from './src/modules'
import Calculators from './src/modules/calculators/Calculators'
import Codes from './src/modules/codes/Codes'
import Diary from './src/modules/diary/Diary'
import Medicines from './src/modules/medicines/Medicines'
import Home from './src/pages/Home'
import { RouteParams } from './src/routeParams'
import { GREEN } from './src/shared/ui/colors'
import { Login } from './src/modules/login/pages/Login'
const Stack = createNativeStackNavigator<RouteParams>()
export default function App() {
const components: Record<string, any> = {
[MyHealthModule.Calculators]: Calculators,
[MyHealthModule.Codes]: Codes,
[MyHealthModule.Diary]: Diary,
[MyHealthModule.Medicines]: Medicines,
}
const TITLE_STYLES: Partial<NativeStackNavigationOptions> = {
headerTitleAlign: 'center',
headerStyle: {
backgroundColor: GREEN,
},
headerTintColor: 'white',
}
return (
<NavigationContainer
theme={{
...DefaultTheme,
colors: {
...DefaultTheme.colors,
background: 'white',
},
}}
>
{/* Definição de rotas do aplicativo */}
<Stack.Navigator initialRouteName="Login">
{/* Tela de login */}
<Stack.Screen
name="Login"
component={Login}
options={{ headerShown: false }}
></Stack.Screen>
{/* Tela principal (Home) */}
<Stack.Screen
name="Home"
component={Home}
options={{ ...TITLE_STYLES, title: 'My Health' }}
></Stack.Screen>
{/* Módulos */}
{Object.values(MyHealthModule).map((module) => (
<Stack.Screen
key={module}
name={module}
component={components[module]}
options={TITLE_STYLES}
></Stack.Screen>
))}
</Stack.Navigator>
</NavigationContainer>
)
}