diff options
Diffstat (limited to 'app/(auth)/_layout.tsx')
| -rw-r--r-- | app/(auth)/_layout.tsx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/app/(auth)/_layout.tsx b/app/(auth)/_layout.tsx new file mode 100644 index 0000000..e18b629 --- /dev/null +++ b/app/(auth)/_layout.tsx @@ -0,0 +1,29 @@ +import { Redirect, Stack } from "expo-router"; +import { useAuth } from "../../lib/auth"; +import { colors } from "../../lib/theme"; +import { LoadingScreen } from "../../lib/ui"; + +export default function AuthLayout() { + const { isLoading, isAuthenticated } = useAuth(); + + if (isLoading) { + return <LoadingScreen />; + } + + if (isAuthenticated) { + return <Redirect href="/(tabs)" />; + } + + return ( + <Stack + screenOptions={{ + headerShown: false, + contentStyle: { backgroundColor: colors.background }, + }} + > + <Stack.Screen name="welcome" /> + <Stack.Screen name="signin" /> + <Stack.Screen name="signup" /> + </Stack> + ); +} |