reactnative_mobilemk/app/(root)/_layout.tsx
2025-01-05 11:01:12 +01:00

19 lines
610 B
TypeScript

import {useGlobalContext} from "@/lib/globalProvider";
import {ActivityIndicator, SafeAreaView} from "react-native";
import React from "react";
import {Redirect, Slot} from "expo-router";
export default function AppLayout() {
const { loading, isLoggedIn} = useGlobalContext();
if (loading) {
return (
<SafeAreaView className={"bg-white h-full flex justify-center items-center"}>
<ActivityIndicator className={"text-blue-500"} size={"large"}/>
</SafeAreaView>
)
}
if(!isLoggedIn) return <Redirect href={"/signin"}/>
return <Slot/>
}