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