freshyo/apps/user-ui/app/(drawer)/(tabs)/me/_layout.tsx
2026-10-09 00:58:12 +05:30

30 lines
779 B
TypeScript

import { Stack } from "expo-router";
import { View } from "react-native";
import { tw, MyText } from "common-ui";
import { useAuth } from "@/src/contexts/AuthContext";
import LoginWall from "@/components/LoginWall";
export default function MeLayout() {
const { isAuthenticated, isLoading } = useAuth();
if (isLoading) {
return (
<View style={tw`flex-1 justify-center items-center bg-gray-50`}>
<MyText style={tw`text-gray-500 font-medium`}>Loading...</MyText>
</View>
);
}
// Inline login gate so Back / tab switching still works.
if (!isAuthenticated) {
return <LoginWall message="Log in to view your profile, orders and more." />;
}
return (
<Stack
screenOptions={{
headerShown: false,
}}
/>
);
}