Origem: D:/Documents/Github/LocalAiApp Arquivos omitidos (segredos, bancos de dados, logs, >50 MB): 0
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native';
|
|
import { Stack } from 'expo-router';
|
|
import * as SplashScreen from 'expo-splash-screen';
|
|
import { StatusBar } from 'expo-status-bar';
|
|
import { useEffect } from 'react';
|
|
import 'react-native-reanimated';
|
|
|
|
import { useColorScheme } from '@/hooks/useColorScheme';
|
|
import { useAppStore } from '@/store/useAppStore';
|
|
|
|
// Prevent the splash screen from auto-hiding before asset loading is complete.
|
|
SplashScreen.preventAutoHideAsync();
|
|
|
|
export default function RootLayout() {
|
|
const systemColorScheme = useColorScheme();
|
|
const themePreference = useAppStore((state) => state.theme);
|
|
|
|
useEffect(() => {
|
|
SplashScreen.hideAsync();
|
|
}, []);
|
|
|
|
const isDark = themePreference === 'system'
|
|
? systemColorScheme === 'dark'
|
|
: themePreference === 'dark';
|
|
|
|
return (
|
|
<ThemeProvider value={isDark ? DarkTheme : DefaultTheme}>
|
|
<Stack>
|
|
<Stack.Screen name="index" options={{ headerShown: false }} />
|
|
<Stack.Screen name="chat" options={{ headerShown: false }} />
|
|
<Stack.Screen name="settings/index" options={{ presentation: 'modal', title: 'Settings' }} />
|
|
<Stack.Screen name="+not-found" />
|
|
</Stack>
|
|
<StatusBar style={isDark ? 'light' : 'dark'} />
|
|
</ThemeProvider>
|
|
);
|
|
}
|