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'; 7 8export default function Content() { 9 const [tab, selectTab] = useState<'album' | 'lyric'>('album'); 10 const orientation = useOrientation(); 11 12 const onPress = () => { 13 if (orientation === 'horizonal') { 14 return; 15 } 16 if (tab === 'album') { 17 selectTab('lyric'); 18 } else { 19 selectTab('album'); 20 } 21 }; 22 23 return ( 24 <TapGestureHandler onActivated={onPress}> 25 <View style={style.wrapper}> 26 {tab === 'album' || orientation === 'horizonal' ? ( 27 <AlbumCover /> 28 ) : ( 29 <Lyric /> 30 )} 31 </View> 32 </TapGestureHandler> 33 ); 34} 35 36const style = StyleSheet.create({ 37 wrapper: { 38 width: '100%', 39 flex: 1, 40 justifyContent: 'center', 41 alignItems: 'center', 42 }, 43}); 44