import { useUserAuthenticationContext } from "@/contexts/UserAuthenticationContext"; import { LOG } from "@logger"; import { createNativeStackNavigator } from "@react-navigation/native-stack"; import HomeUserNotLoggedIn from "@screens/HomeUserNotLoggedIn"; import PaymentResultScreen from "@screens/PaymentResultScreen"; import UserLoginScreen from "@screens/UserLoginScreen"; import WaveQrCodePaymentScreen from "@screens/WaveQrCodePaymentScreen"; import * as SplashScreen from "expo-splash-screen"; import { AppBottomTabsNavigator } from "./AppBottomTabsNavigator"; import type { ImainStackNavigator } from "./Types"; const Stack = createNativeStackNavigator(); const log = LOG.extend("AppMainStackNavigator"); SplashScreen.preventAutoHideAsync(); const AppMainStackNavigator = () => { const { isAuthenticated, isAuthenticating } = useUserAuthenticationContext(); if (isAuthenticating) { log.info("isAuthenticating"); return null; } (async () => { await SplashScreen.hideAsync(); })(); if (!isAuthenticating && !isAuthenticated) { log.info("Navigating to UserLoginScreen"); return ( ); } log.info("Navigating to AppBottomTabsNavigator"); return ( {/* */} ); }; export default AppMainStackNavigator;