1import React, { useEffect } from 'react'; 2import {Image, StyleSheet} from 'react-native'; 3 4import {NavigationContainer} from '@react-navigation/native'; 5import {createNativeStackNavigator} from '@react-navigation/native-stack'; 6import bootstrap from './bootstrap'; 7import {routes} from './router'; 8import {Provider as PaperProvider} from 'react-native-paper'; 9import {GestureHandlerRootView} from 'react-native-gesture-handler'; 10import Dialogs from '@/components/dialogs'; 11import Toast from 'react-native-toast-message'; 12import Panels from '@/components/panels'; 13import {CustomTheme, DarkTheme, DefaultTheme} from './theme'; 14import {useConfig} from '@/common/localConfigManager'; 15import Share from '@/components/share'; 16import PageBackground from '@/components/pageBackground'; 17import RNBootSplash from "react-native-bootsplash"; 18 19// todo: load config 20/** 21 * 字体颜色 22 */ 23 24bootstrap(); 25const Stack = createNativeStackNavigator(); 26 27export default function Pages() { 28 const theme = useConfig('setting.theme.mode') ?? 'dark'; 29 useEffect(() => { 30 if(__DEV__) { 31 RNBootSplash.hide({fade: true}); 32 } 33 }, []); 34 35 return ( 36 <GestureHandlerRootView style={{flex: 1}}> 37 <PaperProvider theme={theme === 'dark'? CustomTheme : DefaultTheme}> 38 <NavigationContainer theme={theme === 'dark'? CustomTheme : DefaultTheme}> 39 <PageBackground></PageBackground> 40 <Stack.Navigator 41 initialRouteName={routes[0].path} 42 screenOptions={{ 43 statusBarColor: 'transparent', 44 statusBarTranslucent: true, 45 headerShown: false, 46 animation: 'slide_from_right', 47 animationDuration: 200, 48 }}> 49 {routes.map(route => ( 50 <Stack.Screen 51 key={route.path} 52 name={route.path} 53 component={route.component}></Stack.Screen> 54 ))} 55 </Stack.Navigator> 56 57 <Panels></Panels> 58 <Dialogs></Dialogs> 59 <Share></Share> 60 <Toast></Toast> 61 </NavigationContainer> 62 </PaperProvider> 63 </GestureHandlerRootView> 64 ); 65} 66 67const style = StyleSheet.create({ 68 blur: { 69 width: '100%', 70 height: '100%', 71 position: 'absolute', 72 top: 0, 73 left: 0, 74 right: 0, 75 bottom: 0, 76 }, 77}); 78