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 type { IauthenticationData } from "./Types";
export interface UserAuthenticationContextProps {
isAuthenticated: boolean;
setIsAuthenticated: React.Dispatch<React.SetStateAction<boolean>>;
......@@ -67,6 +70,9 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
},
});
// Hoooks
const navigation = useNavigation<NavigationProp<ImainStackNavigator>>();
const logout = useCallback(() => {
setIsAuthenticated(false);
setAuthenticationData({
......@@ -94,7 +100,11 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
user: 0,
},
});
}, []);
navigation.reset({
index: 0,
routes: [{ name: "userLoginScreen" }],
});
}, [navigation]);
return (
<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