xref: /MusicFree/src/entry/index.tsx (revision a27adc201796bd0be4a6a41893461b099d480a34)
1import React from 'react';
2import {NavigationContainer} from '@react-navigation/native';
3import {createNativeStackNavigator} from '@react-navigation/native-stack';
4import bootstrap from './bootstrap';
5import {routes} from './router';
6import {GestureHandlerRootView} from 'react-native-gesture-handler';
7import Dialogs from '@/components/dialogs';
8import Toast from 'react-native-toast-message';
9import Panels from '@/components/panels';
10import PageBackground from '@/components/base/pageBackground';
11import {SafeAreaProvider} from 'react-native-safe-area-context';
12import toastConfig from '@/components/base/toast';
13import useBootstrap from './useBootstrap';
14import Debug from '@/components/debug';
15import {ImageViewComponent} from '@/components/imageViewer';
16import {PortalHost} from '@/components/base/portal';
17import globalStyle from '@/constants/globalStyle';
18import Theme from '@/core/theme';
19
20/**
21 * 字体颜色
22 */
23
24bootstrap();
25const Stack = createNativeStackNavigator<any>();
26
27export default function Pages() {
28    const theme = Theme.useTheme();
29    useBootstrap();
30
31    return (
32        <GestureHandlerRootView style={globalStyle.flex1}>
33            <SafeAreaProvider>
34                <NavigationContainer theme={theme}>
35                    <PageBackground />
36                    <Stack.Navigator
37                        initialRouteName={routes[0].path}
38                        screenOptions={{
39                            statusBarColor: 'transparent',
40                            statusBarTranslucent: true,
41                            headerShown: false,
42                            animation: 'slide_from_right',
43                            animationDuration: 100,
44                        }}>
45                        {routes.map(route => (
46                            <Stack.Screen
47                                key={route.path}
48                                name={route.path}
49                                component={route.component}
50                            />
51                        ))}
52                    </Stack.Navigator>
53
54                    <Panels />
55                    <Dialogs />
56                    <ImageViewComponent />
57                    <Toast config={toastConfig} />
58                    <Debug />
59                    <PortalHost />
60                </NavigationContainer>
61            </SafeAreaProvider>
62        </GestureHandlerRootView>
63    );
64}
65