diff --git a/src/navigations/AppMainStackNavigator.tsx b/src/navigations/AppMainStackNavigator.tsx index 5416642..c767f93 100644 --- a/src/navigations/AppMainStackNavigator.tsx +++ b/src/navigations/AppMainStackNavigator.tsx @@ -5,7 +5,7 @@ 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 { memo } from "react"; import { AppBottomTabsNavigator } from "./AppBottomTabsNavigator"; import type { ImainStackNavigator } from "./Types"; @@ -13,20 +13,14 @@ const Stack = createNativeStackNavigator(); const log = LOG.extend("AppMainStackNavigator"); -SplashScreen.preventAutoHideAsync(); +interface IappMainStackNavigatorProps { + isAuthenticated: boolean; +} -const AppMainStackNavigator = () => { - const { isAuthenticated, isAuthenticating } = useUserAuthenticationContext(); - - if (isAuthenticating) { - log.info("isAuthenticating"); - return null; - } - (async () => { - await SplashScreen.hideAsync(); - })(); - if (!isAuthenticating && !isAuthenticated) { +const AppMainStackNavigator: React.FC = ({ isAuthenticated }) => { + if (!isAuthenticated) { log.info("Navigating to UserLoginScreen"); + return ( { ); }; -export default AppMainStackNavigator; +export default memo(AppMainStackNavigator); + +export const AppMainStackNavigatorAuthWrapper = () => { + const { isAuthenticated } = useUserAuthenticationContext(); + return ; +};