diff --git a/src/navigations/InitialNavigationHandler.tsx b/src/navigations/InitialNavigationHandler.tsx new file mode 100644 index 0000000..5562e4d --- /dev/null +++ b/src/navigations/InitialNavigationHandler.tsx @@ -0,0 +1,11 @@ +import { useUserAuthenticationContext } from "@/contexts/UserAuthenticationContext"; +import UnloggedUserStackNavigation from "./UnloggedUserStackNavigation"; + +const InitialNavigationHandler = () => { + const { isAuthenticated } = useUserAuthenticationContext(); + console.log("isAuthenticated", isAuthenticated); + + return ; +}; + +export default InitialNavigationHandler; diff --git a/src/screens/HomeUserNotLoggedIn.tsx b/src/screens/HomeUserNotLoggedIn.tsx index a10fca3..02f0d35 100644 --- a/src/screens/HomeUserNotLoggedIn.tsx +++ b/src/screens/HomeUserNotLoggedIn.tsx @@ -1,3 +1,4 @@ +import { useUserAuthenticationContext } from "@/contexts/UserAuthenticationContext"; import type { UnloggedUserStackScreenComponentProps } from "@/navigations/Types"; import Button from "@components/Button"; import Box from "@components/bases/Box"; @@ -6,6 +7,12 @@ import { Image, StyleSheet } from "react-native"; const HomeUserNotLoggedIn: UnloggedUserStackScreenComponentProps<"homeUserNotLoggedIn"> = ({ navigation, }) => { + const { isAuthenticated } = useUserAuthenticationContext(); + + if (isAuthenticated) { + navigation.replace("bottomTabs"); + } + return (