Jkdsjkdjw

This commit is contained in:
2026-04-25 11:21:39 +02:00
parent 72b45335dd
commit 928db54b3e
6 changed files with 60 additions and 41 deletions

View File

@@ -1,10 +1,8 @@
import { StyleSheet } from "react-native";
import { StyleSheet, View } from "react-native";
import Animated, { useAnimatedRef } from "react-native-reanimated";
import { useColorScheme } from "@/hooks/use-color-scheme";
import { useThemeColor } from "@/hooks/use-theme-color";
import { PropsWithChildren } from "react";
import { View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
type Props = PropsWithChildren<{
@@ -14,7 +12,6 @@ type Props = PropsWithChildren<{
export default function ScrollView({ children, headerBackgroundColor }: Props) {
const scrollRef = useAnimatedRef<Animated.ScrollView>();
const insets = useSafeAreaInsets();
const colorScheme = useColorScheme() ?? "light";
const backgroundColor = useThemeColor({}, "background");
return (

View File

@@ -1,9 +1,33 @@
import { useEffect } from "react";
import { Stack, useRouter, useSegments } from "expo-router";
import { BirthdaysProvider } from "@/context/birthdays-context";
import { useAuth } from "@/context/auth-context";
import { Stack, router, useRootNavigationState, useSegments } from "expo-router";
import { useEffect } from "react";
export default function RootLayout() {
const { user, isHydrated } = useAuth();
const navigationState = useRootNavigationState();
const segments = useSegments();
useEffect(() => {
if (!isHydrated || !navigationState?.key) {
return;
}
const inAuthGroup = segments[0] === "(auth)";
if (!user && !inAuthGroup) {
router.replace("/(auth)/login");
return;
}
if (user && inAuthGroup) {
router.replace("/(tabs)");
}
}, [isHydrated, navigationState?.key, segments, user]);
return (
<Stack screenOptions={{ headerShown: false }} />
<BirthdaysProvider>
<Stack screenOptions={{ headerShown: false }} />
</BirthdaysProvider>
);
}
}