mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-02-13 19:24:44 +08:00
- Updated EpisodeSelectionModal to utilize Zustand for episode selection state. - Refactored PlayerControls to manage playback state and controls using Zustand. - Simplified SettingsModal to handle settings state with Zustand. - Introduced homeStore for managing home screen categories and content data. - Created playerStore for managing video playback and episode details. - Added settingsStore for managing API settings and modal visibility. - Updated package.json to include Zustand as a dependency. - Cleaned up code formatting and improved readability across components.
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native';
|
|
import { useFonts } from 'expo-font';
|
|
import { Stack } from 'expo-router';
|
|
import * as SplashScreen from 'expo-splash-screen';
|
|
import { useEffect } from 'react';
|
|
import { Platform, useColorScheme } from 'react-native';
|
|
|
|
import { useSettingsStore } from '@/stores/settingsStore';
|
|
|
|
// Prevent the splash screen from auto-hiding before asset loading is complete.
|
|
SplashScreen.preventAutoHideAsync();
|
|
|
|
export default function RootLayout() {
|
|
const colorScheme = useColorScheme();
|
|
const [loaded, error] = useFonts({
|
|
SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),
|
|
});
|
|
const initializeSettings = useSettingsStore(state => state.loadSettings);
|
|
|
|
useEffect(() => {
|
|
initializeSettings();
|
|
}, [initializeSettings]);
|
|
|
|
useEffect(() => {
|
|
if (loaded || error) {
|
|
SplashScreen.hideAsync();
|
|
if (error) {
|
|
console.warn(`Error in loading fonts: ${error}`);
|
|
}
|
|
}
|
|
}, [loaded, error]);
|
|
|
|
if (!loaded && !error) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
|
|
<Stack>
|
|
<Stack.Screen name="index" options={{ headerShown: false }} />
|
|
<Stack.Screen name="detail" options={{ headerShown: false }} />
|
|
{Platform.OS !== 'web' && <Stack.Screen name="play" options={{ headerShown: false }} />}
|
|
<Stack.Screen name="search" options={{ headerShown: false }} />
|
|
<Stack.Screen name="+not-found" />
|
|
</Stack>
|
|
</ThemeProvider>
|
|
);
|
|
}
|