1import React, {useState} from 'react'; 2import {StyleSheet, View} from 'react-native'; 3import rpx from '@/utils/rpx'; 4import AlbumCover from './albumCover'; 5import Lyric from './lyric'; 6import {TapGestureHandler} from 'react-native-gesture-handler'; 7 8export default function Content() { 9 const [tab, selectTab] = useState<'album' | 'lyric'>('album'); 10 11 const onPress = () => { 12 if (tab === 'album') { 13 selectTab('lyric'); 14 } else { 15 selectTab('album'); 16 } 17 }; 18 19 return ( 20 <TapGestureHandler onActivated={onPress}> 21 <View style={style.wrapper}> 22 {tab === 'album' ? <AlbumCover /> : <Lyric />} 23 </View> 24 </TapGestureHandler> 25 ); 26} 27 28const style = StyleSheet.create({ 29 wrapper: { 30 width: rpx(750), 31 flex: 1, 32 justifyContent: 'center', 33 alignItems: 'center', 34 }, 35}); 36