| 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: "(tabs)",
|
| 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 | }}
|
| 41 | />
|
| 42 |
|
| 43 | <Stack.Screen
|
| 44 | name="profile"
|
| 45 | options={{
|
| 46 | title: "Editar perfil",
|
| 47 | }}
|
| 48 | />
|
| 49 |
|
| 50 | <Stack.Screen
|
| 51 | name="entry/mood-components"
|
| 52 | options={{
|
| 53 | presentation: "formSheet",
|
| 54 | title: "Editar Componentes",
|
| 55 | sheetAllowedDetents: [0.25, 0.5, 1],
|
| 56 | sheetInitialDetentIndex: 1,
|
| 57 | animation: "slide_from_bottom",
|
| 58 | }}
|
| 59 | />
|
| 60 |
|
| 61 | <Stack.Screen
|
| 62 | name="care-actions/post-appointment"
|
| 63 | options={{ headerShown: false }}
|
| 64 | />
|
| 65 |
|
| 66 | <Stack.Screen
|
| 67 | name="sleep/new"
|
| 68 | options={{
|
| 69 | title: "Registrar Sono",
|
| 70 | }}
|
| 71 | />
|
| 72 |
|
| 73 | <Stack.Screen
|
| 74 | name="triggers/new"
|
| 75 | options={{
|
| 76 | title: "Registrar Gatilho",
|
| 77 | }}
|
| 78 | />
|
| 79 |
|
| 80 | <Stack.Screen
|
| 81 | name="care-actions/new"
|
| 82 | options={{
|
| 83 | presentation: "formSheet",
|
| 84 | title: "Registrar Ação de Cuidado",
|
| 85 | sheetAllowedDetents: [0.25, 0.5, 0.7],
|
| 86 | sheetInitialDetentIndex: 1,
|
| 87 | animation: "slide_from_bottom",
|
| 88 | }}
|
| 89 | />
|
| 90 | <Stack.Screen
|
| 91 | name="care-actions/medicine"
|
| 92 | options={{ title: "Medicamento" }}
|
| 93 | />
|
| 94 | <Stack.Screen
|
| 95 | name="care-actions/medicine-new"
|
| 96 | options={{ title: "Novo Medicamento" }}
|
| 97 | />
|
| 98 | <Stack.Screen
|
| 99 | name="care-actions/appointment"
|
| 100 | options={{ title: "Consulta" }}
|
| 101 | />
|
| 102 | <Stack.Screen
|
| 103 | name="care-actions/activity"
|
| 104 | options={{ title: "Atividade" }}
|
| 105 | />
|
| 106 |
|
| 107 | <Stack.Screen
|
| 108 | name="medicine-regimens/index"
|
| 109 | options={{ title: "Gerenciar Medicamentos" }}
|
| 110 | />
|
| 111 |
|
| 112 | <Stack.Screen
|
| 113 | name="notifications"
|
| 114 | options={{
|
| 115 | presentation: "modal",
|
| 116 | title: "Notificações",
|
| 117 | }}
|
| 118 | />
|
| 119 |
|
| 120 | <Stack.Screen
|
| 121 | name="modal"
|
| 122 | options={{ presentation: "modal", title: "Modal" }}
|
| 123 | />
|
| 124 | </Stack>
|
| 125 | </AuthProvider>
|
| 126 | </ToastProvider>
|
| 127 | </ThemeProvider>
|
| 128 | </QueryClientProvider>
|
| 129 | );
|
| 130 | }
|