| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import { Stack } from 'expo-router/stack';
- import AuthProvider, { useAuth } from '../context/AuthProvider';
- import { EXPO_PUBLIC_NODE_ENV } from '@env';
- import { GestureHandlerRootView } from 'react-native-gesture-handler';
- import { useEffect, useState } from 'react';
- import { checkVersion } from '../component/checkVersion';
- import { authenticationService } from '../service/authService';
- import { usePushNotifications } from './hooks/usePushNotifications';
- export default function RootLayout() {
- const [isLoading, setIsLoading] = useState(true);
- const { user } = useAuth();
- const { expoPushToken, notification } = usePushNotifications();
- console.log('notification', notification);
- console.log('expoPushToken', expoPushToken);
- const data = JSON.stringify(notification, undefined, 2);
- useEffect(() => {
- const fetchVersion = async () => {
- const response = await authenticationService.getVersion();
- checkVersion(response);
- };
- fetchVersion();
- }, []);
- return (
- <GestureHandlerRootView style={{ flex: 1 }}>
- <AuthProvider>
- <Stack>
- <Stack.Screen name="(auth)/(tabs)" options={{ headerShown: false }} />
- <Stack.Screen name="(public)/login" options={{ headerShown: false }} />
- <Stack.Screen name="(public)/registerChooseVehiclesOne" options={{ headerShown: false }} />
- <Stack.Screen name="(public)/registerChooseVehiclesTwo" options={{ headerShown: false }} />
- {/* Testing Purpose */}
- {EXPO_PUBLIC_NODE_ENV == 'development' ? (
- <Stack.Screen
- name="(public)/test"
- options={{
- headerShown: false,
- title: 'Test Component Page'
- }}
- />
- ) : (
- <></>
- )}
- </Stack>
- </AuthProvider>
- </GestureHandlerRootView>
- );
- }
|