import { FlatList } from 'react-native'; import type { Song } from '~/types'; import { formatDuration } from '~/services/audioService'; import { usePlayerStore } from '~/stores/playerStore'; import { Artwork } from './Artwork'; import { EmptyState } from './EmptyState'; import { ListItem } from './ListItem'; interface SongListProps { songs: Song[]; onSongPress?: (song: Song, index: number) => void; emptyTitle?: string; emptyMessage?: string; } export function SongList({ songs, onSongPress, emptyTitle = 'Keine Songs', emptyMessage = 'Importiere Songs über den + Button.', }: SongListProps) { const playSong = usePlayerStore((s) => s.playSong); const handlePress = (song: Song, index: number) => { if (onSongPress) { onSongPress(song, index); } else { playSong(song, songs, index); } }; if (songs.length === 0) { return ; } return ( item.id} renderItem={({ item, index }) => ( } onPress={() => handlePress(item, index)} /> )} contentContainerStyle={{ paddingBottom: 100 }} /> ); }