Commit 89994206 by G

now there is redirection. But the animation is not going in the correct direction

parent 62d8d125
import type { IuserInformations } from "@/utils/requests/types"; import type { ImainStackNavigator } from "@/navigations/Types";
import type { IuserInformations } from "@/utils/requests/Types";
import { type NavigationProp, useNavigation } from "@react-navigation/native";
import { createContext, useCallback, useContext, useState } from "react"; import { createContext, useCallback, useContext, useState } from "react";
import type { IauthenticationData } from "./Types"; import type { IauthenticationData } from "./Types";
export interface UserAuthenticationContextProps { export interface UserAuthenticationContextProps {
isAuthenticated: boolean; isAuthenticated: boolean;
setIsAuthenticated: React.Dispatch<React.SetStateAction<boolean>>; setIsAuthenticated: React.Dispatch<React.SetStateAction<boolean>>;
...@@ -67,6 +70,9 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac ...@@ -67,6 +70,9 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
}, },
}); });
// Hoooks
const navigation = useNavigation<NavigationProp<ImainStackNavigator>>();
const logout = useCallback(() => { const logout = useCallback(() => {
setIsAuthenticated(false); setIsAuthenticated(false);
setAuthenticationData({ setAuthenticationData({
...@@ -94,7 +100,11 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac ...@@ -94,7 +100,11 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
user: 0, user: 0,
}, },
}); });
}, []); navigation.reset({
index: 0,
routes: [{ name: "userLoginScreen" }],
});
}, [navigation]);
return ( return (
<UserAuthenticationContext.Provider <UserAuthenticationContext.Provider
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment