xref: /MusicFree/src/pages/musicDetail/index.tsx (revision 41ddce918e1138d8f16e522cc7c19ac86ceca698)
1*41ddce91Smaotoumaoimport StatusBar from "@/components/base/statusBar";
2*41ddce91Smaotoumaoimport globalStyle from "@/constants/globalStyle";
3*41ddce91Smaotoumaoimport useOrientation from "@/hooks/useOrientation";
4*41ddce91Smaotoumaoimport React, { useEffect } from "react";
5*41ddce91Smaotoumaoimport { StyleSheet, View } from "react-native";
6*41ddce91Smaotoumaoimport { SafeAreaView } from "react-native-safe-area-context";
7*41ddce91Smaotoumaoimport Background from "./components/background";
8*41ddce91Smaotoumaoimport Bottom from "./components/bottom";
9*41ddce91Smaotoumaoimport Content from "./components/content";
10*41ddce91Smaotoumaoimport Lyric from "./components/content/lyric";
11*41ddce91Smaotoumaoimport NavBar from "./components/navBar";
12*41ddce91Smaotoumaoimport Config from "@/core/config.ts";
13*41ddce91Smaotoumaoimport { activateKeepAwakeAsync, deactivateKeepAwake } from "expo-keep-awake";
14bf6e62f2S猫头猫
15bf6e62f2S猫头猫export default function MusicDetail() {
16c446f2b8S猫头猫    const orientation = useOrientation();
17fbdbd2d3S猫头猫
18fbdbd2d3S猫头猫    useEffect(() => {
19*41ddce91Smaotoumao        const needAwake = Config.getConfig('basic.musicDetailAwake');
20fbdbd2d3S猫头猫        if (needAwake) {
2100ebdfd8S猫头猫            activateKeepAwakeAsync();
22fbdbd2d3S猫头猫        }
23fbdbd2d3S猫头猫        return () => {
24fbdbd2d3S猫头猫            if (needAwake) {
25fbdbd2d3S猫头猫                deactivateKeepAwake();
26fbdbd2d3S猫头猫            }
27fbdbd2d3S猫头猫        };
28fbdbd2d3S猫头猫    }, []);
29fbdbd2d3S猫头猫
30bf6e62f2S猫头猫    return (
31e990b02cS猫头猫        <>
324060c00aS猫头猫            <Background />
334245d81aS猫头猫            <SafeAreaView style={globalStyle.fwflex1}>
344060c00aS猫头猫                <StatusBar backgroundColor={'transparent'} />
35c446f2b8S猫头猫                <View style={style.bodyWrapper}>
364245d81aS猫头猫                    <View style={globalStyle.flex1}>
374060c00aS猫头猫                        <NavBar />
384060c00aS猫头猫                        <Content />
394060c00aS猫头猫                        <Bottom />
40bf6e62f2S猫头猫                    </View>
41ab5f994aSmaotoumao                    {orientation === 'horizontal' ? (
4213cebe63S猫头猫                        <View style={globalStyle.flex1}>
4313cebe63S猫头猫                            <Lyric />
4413cebe63S猫头猫                        </View>
4513cebe63S猫头猫                    ) : null}
46c446f2b8S猫头猫                </View>
471c06c799S猫头猫            </SafeAreaView>
48e990b02cS猫头猫        </>
49bf6e62f2S猫头猫    );
50bf6e62f2S猫头猫}
51bf6e62f2S猫头猫
52bf6e62f2S猫头猫const style = StyleSheet.create({
534245d81aS猫头猫    bodyWrapper: {
54c446f2b8S猫头猫        width: '100%',
55bf6e62f2S猫头猫        flex: 1,
56c446f2b8S猫头猫        flexDirection: 'row',
57c446f2b8S猫头猫    },
58bf6e62f2S猫头猫});
59