- add babel.config.js with unstable_transformImportMeta: zustand/middleware ships import.meta.env, which the Metro web bundle (a classic script) cannot parse, so every page threw 'SyntaxError: Cannot use import.meta outside a module' and the app never hydrated after the static export. - declare the settings screen as 'settings/index' in the root stack: the old name 'settings' matched no route, so the modal presentation and the 'Settings' title were silently dropped (expo-router logged 'No route named settings exists'). - add the missing app/+not-found.tsx that the root layout already referenced. - update the About label from LocalAiApp to LocalMind.
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>
|
|
);
|
|
}
|