Files
AthenaFE/app/(auth)/_layout.tsx
T
2025-11-02 10:08:56 +01:00

30 lines
730 B
TypeScript

import { Redirect, Stack } from "expo-router";
import { View } from "react-native";
import { useAuthContext } from "@/auth/AuthContext";
import { LoadingSpinner } from "@/components/ui/LoadingSpinner";
const AuthRoutesLayout = () => {
const { isAuthenticated, bootstrapping } = useAuthContext();
if (bootstrapping) {
return (
<View className="flex-1 p-5 bg-primaryPurpleLight">
<View
style={{ flex: 1, justifyContent: "center", alignItems: "center" }}
>
<LoadingSpinner />
</View>
</View>
);
}
if (isAuthenticated) {
return <Redirect href={"/"} />;
}
return <Stack screenOptions={{ headerShown: false }} />;
};
export default AuthRoutesLayout;