xref: /MusicFree/src/pages/musicDetail/index.tsx (revision fbdbd2d374ea1d6b7ba608cea830fa036ad81f46)
119dc08ecS猫头猫import StatusBar from '@/components/base/statusBar';
24245d81aS猫头猫import globalStyle from '@/constants/globalStyle';
3c446f2b8S猫头猫import useOrientation from '@/hooks/useOrientation';
4*fbdbd2d3S猫头猫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';
12*fbdbd2d3S猫头猫import Config from '@/core/config';
13*fbdbd2d3S猫头猫import {
14*fbdbd2d3S猫头猫    activateKeepAwake,
15*fbdbd2d3S猫头猫    deactivateKeepAwake,
16*fbdbd2d3S猫头猫} from '@sayem314/react-native-keep-awake';
17bf6e62f2S猫头猫
18bf6e62f2S猫头猫export default function MusicDetail() {
19c446f2b8S猫头猫    const orientation = useOrientation();
20*fbdbd2d3S猫头猫
21*fbdbd2d3S猫头猫    useEffect(() => {
22*fbdbd2d3S猫头猫        const needAwake = Config.get('setting.basic.musicDetailAwake');
23*fbdbd2d3S猫头猫        if (needAwake) {
24*fbdbd2d3S猫头猫            activateKeepAwake();
25*fbdbd2d3S猫头猫        }
26*fbdbd2d3S猫头猫        return () => {
27*fbdbd2d3S猫头猫            if (needAwake) {
28*fbdbd2d3S猫头猫                deactivateKeepAwake();
29*fbdbd2d3S猫头猫            }
30*fbdbd2d3S猫头猫        };
31*fbdbd2d3S猫头猫    }, []);
32*fbdbd2d3S猫头猫
33bf6e62f2S猫头猫    return (
34e990b02cS猫头猫        <>
354060c00aS猫头猫            <Background />
364245d81aS猫头猫            <SafeAreaView style={globalStyle.fwflex1}>
374060c00aS猫头猫                <StatusBar backgroundColor={'transparent'} />
38c446f2b8S猫头猫                <View style={style.bodyWrapper}>
394245d81aS猫头猫                    <View style={globalStyle.flex1}>
404060c00aS猫头猫                        <NavBar />
414060c00aS猫头猫                        <Content />
424060c00aS猫头猫                        <Bottom />
43bf6e62f2S猫头猫                    </View>
44c446f2b8S猫头猫                    {orientation === 'horizonal' ? <Lyric /> : null}
45c446f2b8S猫头猫                </View>
461c06c799S猫头猫            </SafeAreaView>
47e990b02cS猫头猫        </>
48bf6e62f2S猫头猫    );
49bf6e62f2S猫头猫}
50bf6e62f2S猫头猫
51bf6e62f2S猫头猫const style = StyleSheet.create({
524245d81aS猫头猫    bodyWrapper: {
53c446f2b8S猫头猫        width: '100%',
54bf6e62f2S猫头猫        flex: 1,
55c446f2b8S猫头猫        flexDirection: 'row',
56c446f2b8S猫头猫    },
57bf6e62f2S猫头猫});
58