xref: /MusicFree/src/pages/musicDetail/index.tsx (revision 00ebdfd88c8e59552022d13ff359e57113ece399)
119dc08ecS猫头猫import StatusBar from '@/components/base/statusBar';
24245d81aS猫头猫import globalStyle from '@/constants/globalStyle';
3c446f2b8S猫头猫import useOrientation from '@/hooks/useOrientation';
4fbdbd2d3S猫头猫import React, {useEffect} from 'react';
54060c00aS猫头猫import {StyleSheet, View} from 'react-native';
61c06c799S猫头猫import {SafeAreaView} from 'react-native-safe-area-context';
7bf6e62f2S猫头猫import Background from './components/background';
8bf6e62f2S猫头猫import Bottom from './components/bottom';
9bf6e62f2S猫头猫import Content from './components/content';
10c446f2b8S猫头猫import Lyric from './components/content/lyric';
11bf6e62f2S猫头猫import NavBar from './components/navBar';
12fbdbd2d3S猫头猫import Config from '@/core/config';
13*00ebdfd8S猫头猫import {activateKeepAwakeAsync, deactivateKeepAwake} from 'expo-keep-awake';
14bf6e62f2S猫头猫
15bf6e62f2S猫头猫export default function MusicDetail() {
16c446f2b8S猫头猫    const orientation = useOrientation();
17fbdbd2d3S猫头猫
18fbdbd2d3S猫头猫    useEffect(() => {
19fbdbd2d3S猫头猫        const needAwake = Config.get('setting.basic.musicDetailAwake');
20fbdbd2d3S猫头猫        if (needAwake) {
21*00ebdfd8S猫头猫            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>
4113cebe63S猫头猫                    {orientation === 'horizonal' ? (
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