eletrotupi / tcc/ frontend/app/_layout.tsx3213901cb6f40e18df4c191a91f7a34b28de7a6d
3.4 KB | 125 lines Raw
1
import {
2
  DarkTheme,
3
  DefaultTheme,
4
  ThemeProvider,
5
} from "@react-navigation/native";
6
import { Stack } from "expo-router";
7
import { useColorScheme } from "react-native";
8
import { QueryClientProvider } from "@tanstack/react-query";
9
import { queryClient } from "@/lib/queryClient";
10
import { useNotificationObserver } from "@/hooks/useNotificationObserver";
11
import { AuthProvider } from "@/context/AuthContext";
12

13
export const unstable_settings = {
14
  initialRouteName: "(tabs)",
15
};
16

17
const AppBootstrap = () => {
18
  useNotificationObserver();
19
  return null;
20
};
21

22
export default function RootLayout() {
23
  const colorScheme = useColorScheme();
24

25
  return (
26
    <QueryClientProvider client={queryClient}>
27
      <ThemeProvider value={DefaultTheme}>
28
        <AuthProvider>
29
          <AppBootstrap />
30
          <Stack>
31
            <Stack.Screen name="index" options={{ headerShown: false }} />
32
            <Stack.Screen name="(tabs)" options={{ headerShown: false }} />
33
            <Stack.Screen
34
              name="auth"
35
              options={{
36
                headerShown: false,
37
                presentation: "modal",
38
              }}
39
            />
40

41
            <Stack.Screen
42
              name="profile"
43
              options={{
44
                title: "Editar perfil",
45
              }}
46
            />
47

48
            <Stack.Screen
49
              name="entry/mood-components"
50
              options={{
51
                presentation: "formSheet",
52
                title: "Editar Componentes",
53
                sheetAllowedDetents: [0.25, 0.5, 1],
54
                sheetInitialDetentIndex: 1,
55
              }}
56
            />
57

58
            <Stack.Screen
59
              name="care-actions/post-appointment"
60
              options={{ headerShown: false }}
61
            />
62

63
            <Stack.Screen
64
              name="sleep/new"
65
              options={{
66
                title: "Registrar Sono",
67
              }}
68
            />
69

70
            <Stack.Screen
71
              name="triggers/new"
72
              options={{
73
                title: "Registrar Gatilho",
74
              }}
75
            />
76

77
            <Stack.Screen
78
              name="care-actions/new"
79
              options={{
80
                presentation: "formSheet",
81
                title: "Registrar Ação de Cuidado",
82
                sheetAllowedDetents: [0.25, 0.5, 0.7],
83
                sheetInitialDetentIndex: 1,
84
              }}
85
            />
86
            <Stack.Screen
87
              name="care-actions/medicine"
88
              options={{ title: "Medicamento" }}
89
            />
90
            <Stack.Screen
91
              name="care-actions/medicine-new"
92
              options={{ title: "Novo Medicamento" }}
93
            />
94
            <Stack.Screen
95
              name="care-actions/appointment"
96
              options={{ title: "Consulta" }}
97
            />
98
            <Stack.Screen
99
              name="care-actions/activity"
100
              options={{ title: "Atividade" }}
101
            />
102

103
            <Stack.Screen
104
              name="medicine-regimens/index"
105
              options={{ title: "Gerenciar Medicamentos" }}
106
            />
107

108
            <Stack.Screen
109
              name="notifications"
110
              options={{
111
                presentation: "modal",
112
                title: "Notificações",
113
              }}
114
            />
115

116
            <Stack.Screen
117
              name="modal"
118
              options={{ presentation: "modal", title: "Modal" }}
119
            />
120
          </Stack>
121
        </AuthProvider>
122
      </ThemeProvider>
123
    </QueryClientProvider>
124
  );
125
}