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