2024-12-01 11:29:47 +00:00
|
|
|
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native'
|
2024-12-10 20:50:22 +00:00
|
|
|
import { Stack, useNavigationContainerRef } from 'expo-router'
|
2024-12-01 17:58:53 +00:00
|
|
|
import { StatusBar } from 'expo-status-bar'
|
2024-12-09 20:00:15 +00:00
|
|
|
import { Provider as StoreProvider } from 'react-redux'
|
|
|
|
import { MD3DarkTheme, MD3LightTheme, PaperProvider } from 'react-native-paper'
|
2024-12-10 20:50:22 +00:00
|
|
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
|
|
import { useReactNavigationDevTools } from '@dev-plugins/react-navigation'
|
|
|
|
import { useReactQueryDevTools } from '@dev-plugins/react-query'
|
|
|
|
import { useColorScheme } from '@/hooks/useColorScheme'
|
2024-12-06 20:49:28 +00:00
|
|
|
import store from '@/utils/store'
|
2024-12-09 23:52:15 +00:00
|
|
|
import { useStartBackgroundFetchServiceEffect } from '@/utils/background'
|
2024-12-06 20:49:28 +00:00
|
|
|
import { useStartGeolocationServiceEffect } from '@/utils/geolocation'
|
2024-12-10 17:56:50 +00:00
|
|
|
import LoginProvider from '@/components/LoginProvider'
|
2024-12-01 11:29:47 +00:00
|
|
|
|
2024-12-10 20:50:22 +00:00
|
|
|
const queryClient = new QueryClient()
|
|
|
|
|
2024-12-01 11:29:47 +00:00
|
|
|
export default function RootLayout() {
|
2024-12-06 20:49:28 +00:00
|
|
|
useStartGeolocationServiceEffect()
|
2024-12-09 23:52:15 +00:00
|
|
|
useStartBackgroundFetchServiceEffect()
|
2024-12-01 11:29:47 +00:00
|
|
|
const colorScheme = useColorScheme()
|
2024-12-06 18:00:51 +00:00
|
|
|
|
2024-12-10 20:50:22 +00:00
|
|
|
const navigationRef = useNavigationContainerRef()
|
|
|
|
useReactNavigationDevTools(navigationRef)
|
|
|
|
|
|
|
|
useReactQueryDevTools(queryClient)
|
|
|
|
|
2024-12-06 20:49:28 +00:00
|
|
|
return (
|
2024-12-09 20:00:15 +00:00
|
|
|
<StoreProvider store={store}>
|
2024-12-10 20:50:22 +00:00
|
|
|
<QueryClientProvider client={queryClient}>
|
|
|
|
<LoginProvider loginRedirect={'/login'}>
|
|
|
|
<PaperProvider theme={colorScheme === 'dark' ? MD3DarkTheme : MD3LightTheme}>
|
|
|
|
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
|
|
|
|
<Stack>
|
|
|
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
|
|
<Stack.Screen name="login" options={{ headerShown: false }} />
|
|
|
|
<Stack.Screen name="+not-found" />
|
|
|
|
</Stack>
|
|
|
|
<StatusBar style="auto" />
|
|
|
|
</ThemeProvider>
|
|
|
|
</PaperProvider>
|
|
|
|
</LoginProvider>
|
|
|
|
</QueryClientProvider>
|
2024-12-09 20:00:15 +00:00
|
|
|
</StoreProvider>
|
2024-12-06 20:49:28 +00:00
|
|
|
)
|
2024-12-01 11:29:47 +00:00
|
|
|
}
|