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