1import React, {useState} from 'react'; 2import {StyleSheet, View} from 'react-native'; 3import AlbumCover from './albumCover'; 4import Lyric from './lyric'; 5import {TapGestureHandler} from 'react-native-gesture-handler'; 6import useOrientation from '@/hooks/useOrientation'; 7import Config from '@/core/config'; 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 15 const onPress = () => { 16 if (orientation === 'horizonal') { 17 return; 18 } 19 if (tab === 'album') { 20 selectTab('lyric'); 21 } else { 22 selectTab('album'); 23 } 24 }; 25 26 return ( 27 <TapGestureHandler onActivated={onPress}> 28 <View style={style.wrapper}> 29 {tab === 'album' || orientation === 'horizonal' ? ( 30 <AlbumCover /> 31 ) : ( 32 <Lyric /> 33 )} 34 </View> 35 </TapGestureHandler> 36 ); 37} 38 39const style = StyleSheet.create({ 40 wrapper: { 41 width: '100%', 42 flex: 1, 43 justifyContent: 'center', 44 alignItems: 'center', 45 }, 46}); 47