_layout.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { Stack } from 'expo-router/stack';
  2. import AuthProvider, { useAuth } from '../context/AuthProvider';
  3. import { EXPO_PUBLIC_NODE_ENV } from '@env';
  4. import * as SecureStore from 'expo-secure-store';
  5. import { GestureHandlerRootView } from 'react-native-gesture-handler';
  6. import { useEffect, useState } from 'react';
  7. import { ActivityIndicator, View } from 'react-native';
  8. import { checkVersion } from '../component/checkVersion';
  9. import { authenticationService } from '../service/authService';
  10. export default function RootLayout() {
  11. const [isLoading, setIsLoading] = useState(true);
  12. const { user } = useAuth();
  13. // useEffect(() => {
  14. // const fetchVersion = async () => {
  15. // const response = await authenticationService.getVersion();
  16. // console.log('response', response);
  17. // checkVersion(response);
  18. // };
  19. // fetchVersion();
  20. // }, []);
  21. return (
  22. <GestureHandlerRootView style={{ flex: 1 }}>
  23. <AuthProvider>
  24. <Stack>
  25. <Stack.Screen name="(auth)/(tabs)" options={{ headerShown: false }} />
  26. <Stack.Screen name="(public)/login" options={{ headerShown: false }} />
  27. <Stack.Screen name="(public)/registerChooseVehiclesOne" options={{ headerShown: false }} />
  28. <Stack.Screen name="(public)/registerChooseVehiclesTwo" options={{ headerShown: false }} />
  29. {/* Testing Purpose */}
  30. {EXPO_PUBLIC_NODE_ENV == 'development' ? (
  31. <Stack.Screen
  32. name="(public)/test"
  33. options={{
  34. headerShown: false,
  35. title: 'Test Component Page'
  36. }}
  37. />
  38. ) : (
  39. <></>
  40. )}
  41. </Stack>
  42. </AuthProvider>
  43. </GestureHandlerRootView>
  44. );
  45. }