1import React from 'react'; 2import {useNavigation, useRoute} from '@react-navigation/native'; 3import AppBarWithSearch from '@/components/base/appBarWithSearch'; 4import MusicSheet from '@/core/musicSheet'; 5import {ROUTE_PATH} from '@/entry/router'; 6import useDialog from '@/components/dialogs/useDialog'; 7import Toast from '@/utils/toast'; 8 9export default function () { 10 const navigation = useNavigation<any>(); 11 const route = useRoute<any>(); 12 const id = route.params?.id ?? 'favorite'; 13 const musicSheet = MusicSheet.useSheets(id); 14 const {showDialog} = useDialog(); 15 16 return ( 17 <AppBarWithSearch 18 title="歌单" 19 onSearchPress={() => { 20 navigation.navigate(ROUTE_PATH.SEARCH_MUSIC_LIST, { 21 musicList: musicSheet?.musicList, 22 }); 23 }} 24 menuOptions={[ 25 { 26 icon: 'trash-can-outline', 27 title: '删除歌单', 28 show: id !== 'favorite', 29 onPress() { 30 showDialog('SimpleDialog', { 31 title: '删除歌单', 32 content: `确定删除歌单${musicSheet.title}吗?`, 33 onOk: async () => { 34 await MusicSheet.removeSheet(id); 35 Toast.success('已删除'); 36 navigation.goBack(); 37 }, 38 }); 39 }, 40 }, 41 ]} 42 /> 43 ); 44} 45