xref: /MusicFree/src/entry/index.tsx (revision 7a8d024e62c773caa4d0887b9fec4611e8a8ef82)
14060c00aS猫头猫import React from 'react';
2bf6e62f2S猫头猫import {NavigationContainer} from '@react-navigation/native';
3bf6e62f2S猫头猫import {createNativeStackNavigator} from '@react-navigation/native-stack';
4bf6e62f2S猫头猫import bootstrap from './bootstrap';
5e7fa3837S猫头猫import {routes} from './router';
6bf6e62f2S猫头猫import {Provider as PaperProvider} from 'react-native-paper';
7bf6e62f2S猫头猫import {GestureHandlerRootView} from 'react-native-gesture-handler';
8bf6e62f2S猫头猫import Dialogs from '@/components/dialogs';
9bf6e62f2S猫头猫import Toast from 'react-native-toast-message';
10bf6e62f2S猫头猫import Panels from '@/components/panels';
1108a8e62cS猫头猫import {CustomTheme, DefaultTheme} from './theme';
12e22d5e4fS猫头猫import Config from '@/core/config';
1319dc08ecS猫头猫import PageBackground from '@/components/base/pageBackground';
141c06c799S猫头猫import {SafeAreaProvider} from 'react-native-safe-area-context';
152a3194f5S猫头猫import toastConfig from '@/components/base/toast';
16cf2d630eS猫头猫import useBootstrap from './useBootstrap';
17ea6d708fS猫头猫import Debug from '@/components/debug';
18a33ab089S猫头猫import {ImageViewComponent} from '@/components/imageViewer';
19*7a8d024eS猫头猫import {PortalHost} from '@/components/base/portal';
20bf6e62f2S猫头猫
21bf6e62f2S猫头猫/**
22bf6e62f2S猫头猫 * 字体颜色
23bf6e62f2S猫头猫 */
24bf6e62f2S猫头猫
25bf6e62f2S猫头猫bootstrap();
26e7fa3837S猫头猫const Stack = createNativeStackNavigator<any>();
27bf6e62f2S猫头猫
28bf6e62f2S猫头猫export default function Pages() {
29e22d5e4fS猫头猫    const themeName = Config.useConfig('setting.theme.mode') ?? 'dark';
30e22d5e4fS猫头猫    const themeColors = Config.useConfig('setting.theme.colors') ?? {};
31c7676810S猫头猫    const theme = themeName.includes('dark') ? CustomTheme : DefaultTheme;
32c7676810S猫头猫    const isCustom = themeName.includes('custom') ? true : false;
33c7676810S猫头猫    const mergedTheme = isCustom
34c7676810S猫头猫        ? {
350d39db21S猫头猫              ...theme,
360d39db21S猫头猫              colors: {
370d39db21S猫头猫                  ...theme.colors,
380d39db21S猫头猫                  ...themeColors,
390d39db21S猫头猫              },
40c7676810S猫头猫          }
41c7676810S猫头猫        : theme;
42bf6e62f2S猫头猫
43cf2d630eS猫头猫    useBootstrap();
44cf2d630eS猫头猫
45bf6e62f2S猫头猫    return (
46bf6e62f2S猫头猫        <GestureHandlerRootView style={{flex: 1}}>
470d39db21S猫头猫            <PaperProvider theme={mergedTheme}>
481c06c799S猫头猫                <SafeAreaProvider>
490d39db21S猫头猫                    <NavigationContainer theme={mergedTheme}>
504060c00aS猫头猫                        <PageBackground />
51bf6e62f2S猫头猫                        <Stack.Navigator
52bf6e62f2S猫头猫                            initialRouteName={routes[0].path}
53bf6e62f2S猫头猫                            screenOptions={{
54bf6e62f2S猫头猫                                statusBarColor: 'transparent',
55bf6e62f2S猫头猫                                statusBarTranslucent: true,
56bf6e62f2S猫头猫                                headerShown: false,
57bf6e62f2S猫头猫                                animation: 'slide_from_right',
585f52c604S猫头猫                                animationDuration: 100,
59bf6e62f2S猫头猫                            }}>
60bf6e62f2S猫头猫                            {routes.map(route => (
61bf6e62f2S猫头猫                                <Stack.Screen
62bf6e62f2S猫头猫                                    key={route.path}
63bf6e62f2S猫头猫                                    name={route.path}
644060c00aS猫头猫                                    component={route.component}
654060c00aS猫头猫                                />
66bf6e62f2S猫头猫                            ))}
67bf6e62f2S猫头猫                        </Stack.Navigator>
68bf6e62f2S猫头猫
694060c00aS猫头猫                        <Panels />
704060c00aS猫头猫                        <Dialogs />
71a33ab089S猫头猫                        <ImageViewComponent />
722a3194f5S猫头猫                        <Toast config={toastConfig} />
73ea6d708fS猫头猫                        <Debug />
74*7a8d024eS猫头猫                        <PortalHost />
75bf6e62f2S猫头猫                    </NavigationContainer>
761c06c799S猫头猫                </SafeAreaProvider>
77bf6e62f2S猫头猫            </PaperProvider>
78bf6e62f2S猫头猫        </GestureHandlerRootView>
79bf6e62f2S猫头猫    );
80bf6e62f2S猫头猫}
81