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