eletrotupi / tcc/ frontend/app/_layout.tsx8211b325c85993a45d2c38f30b068b421a9e6b39
3.9 KB | 141 lines Raw
1
import {
2
  DarkTheme,
3
  DefaultTheme,
4
  Stack,
5
  ThemeProvider,
6
} 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
import { ToastProvider } from "@/context/ToastContext";
13

14
export const unstable_settings = {
15
  initialRouteName: "index",
16
};
17

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

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

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

44
            <Stack.Screen
45
              name="onboarding"
46
              options={{ headerShown: false, gestureEnabled: false }}
47
            />
48

49
            <Stack.Screen
50
              name="terms"
51
              options={{ title: "Termos e Condições" }}
52
            />
53

54
            <Stack.Screen
55
              name="profile"
56
              options={{
57
                title: "Editar perfil",
58
              }}
59
            />
60

61
            <Stack.Screen
62
              name="entry/mood-components"
63
              options={{
64
                presentation: "formSheet",
65
                title: "Editar Componentes",
66
                sheetAllowedDetents: [0.25, 0.5, 1],
67
                sheetInitialDetentIndex: 1,
68
                animation: "slide_from_bottom",
69
              }}
70
            />
71

72
            <Stack.Screen
73
              name="care-actions/post-appointment"
74
              options={{ headerShown: false }}
75
            />
76

77
            <Stack.Screen
78
              name="sleep/new"
79
              options={{
80
                title: "Registrar Sono",
81
              }}
82
            />
83

84
            <Stack.Screen
85
              name="triggers/new"
86
              options={{
87
                title: "Registrar Gatilho",
88
              }}
89
            />
90

91
            <Stack.Screen
92
              name="care-actions/new"
93
              options={{
94
                presentation: "formSheet",
95
                title: "Registrar Ação de Cuidado",
96
                sheetAllowedDetents: [0.25, 0.5, 0.7],
97
                sheetInitialDetentIndex: 1,
98
                animation: "slide_from_bottom",
99
              }}
100
            />
101
            <Stack.Screen
102
              name="care-actions/medicine"
103
              options={{ title: "Medicamento" }}
104
            />
105
            <Stack.Screen
106
              name="care-actions/medicine-new"
107
              options={{ title: "Novo Medicamento" }}
108
            />
109
            <Stack.Screen
110
              name="care-actions/appointment"
111
              options={{ title: "Consulta" }}
112
            />
113
            <Stack.Screen
114
              name="care-actions/activity"
115
              options={{ title: "Atividade" }}
116
            />
117

118
            <Stack.Screen
119
              name="medicine-regimens/index"
120
              options={{ title: "Gerenciar Medicamentos" }}
121
            />
122

123
            <Stack.Screen
124
              name="notifications"
125
              options={{
126
                presentation: "modal",
127
                title: "Notificações",
128
              }}
129
            />
130

131
            <Stack.Screen
132
              name="modal"
133
              options={{ presentation: "modal", title: "Modal" }}
134
            />
135
          </Stack>
136
        </AuthProvider>
137
        </ToastProvider>
138
      </ThemeProvider>
139
    </QueryClientProvider>
140
  );
141
}