1import React, {useState} from 'react'; 2import {View} from 'react-native'; 3import AlbumCover from './albumCover'; 4import Lyric from './lyric'; 5import useOrientation from '@/hooks/useOrientation'; 6import Config from '@/core/config'; 7import globalStyle from '@/constants/globalStyle'; 8 9export default function Content() { 10 const [tab, selectTab] = useState<'album' | 'lyric'>( 11 Config.get('setting.basic.musicDetailDefault') || 'album', 12 ); 13 const orientation = useOrientation(); 14 const showAlbumCover = tab === 'album' || orientation === 'horizontal'; 15 16 const onTurnPageClick = () => { 17 if (orientation === 'horizontal') { 18 return; 19 } 20 if (tab === 'album') { 21 selectTab('lyric'); 22 } else { 23 selectTab('album'); 24 } 25 }; 26 27 return ( 28 <View style={globalStyle.fwflex1}> 29 {showAlbumCover ? ( 30 <AlbumCover onTurnPageClick={onTurnPageClick} /> 31 ) : ( 32 <Lyric onTurnPageClick={onTurnPageClick} /> 33 )} 34 </View> 35 ); 36} 37