From ddead116fc6d90ff4c537814988abbcba5027c03 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Fri, 12 Jul 2024 19:25:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=AD=8C=E6=9B=B2=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=B7=BB=E5=8A=A0=E5=A4=9A=E9=80=89=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 2 +- .../Views/Mylist/MyList/DuplicateMusic.tsx | 143 +++++++++++++----- src/screens/Home/Views/Mylist/MyList/utils.ts | 3 + 3 files changed, 111 insertions(+), 37 deletions(-) diff --git a/publish/changeLog.md b/publish/changeLog.md index 2348ce0..2ce2014 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -3,4 +3,4 @@ ### 新增 -- 新增重复歌曲列表,可以方便移除我的列表中的重复歌曲,此列表会列出目标列表里歌曲名相同的歌曲,可在“我的列表”里的列表名菜单中使用 +- 新增重复歌曲列表,可以方便移除我的列表中的重复歌曲,此列表会列出目标列表里歌曲名相同的歌曲,可在“我的列表”里的列表名菜单中使用(注:该功能与PC端的区别是可以点击歌曲名多选删除) diff --git a/src/screens/Home/Views/Mylist/MyList/DuplicateMusic.tsx b/src/screens/Home/Views/Mylist/MyList/DuplicateMusic.tsx index 272f54d..6d1837b 100644 --- a/src/screens/Home/Views/Mylist/MyList/DuplicateMusic.tsx +++ b/src/screens/Home/Views/Mylist/MyList/DuplicateMusic.tsx @@ -2,16 +2,17 @@ import { useRef, useImperativeHandle, forwardRef, useState, useCallback, memo, u import Text from '@/components/common/Text' import { createStyle } from '@/utils/tools' import Dialog, { type DialogType } from '@/components/common/Dialog' -import { FlatList, View, type FlatListProps as _FlatListProps } from 'react-native' +import { FlatList, TouchableOpacity, View, type FlatListProps as _FlatListProps } from 'react-native' import { scaleSizeH } from '@/utils/pixelRatio' import { useTheme } from '@/store/theme/hook' import { type DuplicateMusicItem, filterDuplicateMusic } from './utils' import { getListMusics, removeListMusics } from '@/core/list' -import Button from '@/components/common/Button' import { Icon } from '@/components/common/Icon' import { useUnmounted } from '@/utils/hooks' import { playList } from '@/core/player/player' import { useI18n } from '@/lang' +import { handleRemove } from '../MusicList/listAction' +import Button from '@/components/common/Button' type FlatListProps = _FlatListProps const ITEM_HEIGHT = scaleSizeH(56) @@ -37,20 +38,23 @@ const Empty = () => { ) } -const ListItem = memo(({ info, index, onRemove, onPlay }: { +const ListItem = memo(({ info, index, onRemove, onPlay, selectedList, onPress }: { info: DuplicateMusicItem index: number + selectedList: DuplicateMusicItem[] onPlay: (info: DuplicateMusicItem) => void onRemove: (idx: number) => void + onPress: (info: DuplicateMusicItem) => void }) => { const theme = useTheme() + const isSelected = selectedList.includes(info) return ( - true}> - + true}> + {/* {info.index + 1} - - + */} + { onPress(info) }}> {info.musicInfo.name} @@ -62,12 +66,10 @@ const ListItem = memo(({ info, index, onRemove, onPlay }: { } - + - { info.musicInfo.source } - - - {info.musicInfo.interval} + { info.musicInfo.source } + {info.musicInfo.interval}