xref: /MusicFree/src/entry/index.tsx (revision b4c389f44ac4dad056e7314478fadd2eca82a4b1)
1import React from "react";
2import { NavigationContainer } from "@react-navigation/native";
3import { createNativeStackNavigator } from "@react-navigation/native-stack";
4import bootstrap from "./bootstrap";
5import { GestureHandlerRootView } from "react-native-gesture-handler";
6import Dialogs from "@/components/dialogs";
7import Panels from "@/components/panels";
8import PageBackground from "@/components/base/pageBackground";
9import { SafeAreaProvider } from "react-native-safe-area-context";
10import Debug from "@/components/debug";
11import { PortalHost } from "@/components/base/portal";
12import globalStyle from "@/constants/globalStyle";
13import Theme from "@/core/theme";
14import { BootstrapComp } from "./useBootstrap";
15import { ToastBaseComponent } from "@/components/base/toast";
16import { StatusBar } from "react-native";
17import { ReducedMotionConfig, ReduceMotion } from "react-native-reanimated";
18import { routes } from "@/core/router/routes.tsx";
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}>
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