feat: add auth

This commit is contained in:
Max Koon
2025-10-12 16:03:28 -04:00
parent 0446893a67
commit b4d13e6a9f
17 changed files with 657 additions and 281 deletions

View File

@@ -4,6 +4,7 @@ import { StatusBar } from 'expo-status-bar';
import 'react-native-reanimated';
import { useColorScheme } from '@/hooks/use-color-scheme';
import { authClient } from '@/lib/auth-client';
export const unstable_settings = {
anchor: '(tabs)',
@@ -11,12 +12,17 @@ export const unstable_settings = {
export default function RootLayout() {
const colorScheme = useColorScheme();
const { data, isPending } = authClient.useSession();
return (
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
<Stack>
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
<Stack.Screen name="modal" options={{ presentation: 'modal', title: 'Modal' }} />
<Stack.Protected guard={!isPending && !!data}>
<Stack.Screen name="index" />
</Stack.Protected>
<Stack.Protected guard={!isPending && !data}>
<Stack.Screen name="auth" />
</Stack.Protected>
</Stack>
<StatusBar style="auto" />
</ThemeProvider>