diff --git a/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx b/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx
index f7e748a..c5214fc 100644
--- a/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx
+++ b/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx
@@ -1,3 +1,7 @@
+import {
+ PlaylistSearchBar,
+ usePlaylistSearch,
+} from "@/components/playlist-search-bar"
import { useAndroidScreenPalette } from "@/contexts/android-tab-theme"
import { MusicEntityView } from "@/components/music-entity-view"
import { useMutation } from "convex/react"
@@ -158,6 +162,8 @@ function PlaylistContent({
const isSubscribed = playlist.isSubscribed
const canEdit = playlist.isOwner && playlistId !== null
const songIds = useMemo(() => songs.map((song) => song.id), [songs])
+ const { filteredSongs, onQueryChange, onSearchSubmit } =
+ usePlaylistSearch(songs)
const swipeGroup = useSwipeRowGroup()
const handlePlaySong = useCallback(
@@ -312,10 +318,14 @@ function PlaylistContent({
) : null}
+
+ {songs.length ? "No songs found." : "No songs in this playlist."}
+
+ }
ListHeaderComponent={
songs.map((song) => song.id), [songs])
+ const { filteredSongs, onQueryChange, onSearchSubmit } =
+ usePlaylistSearch(songs)
useEffect(() => {
if (favorites) rememberSongs(favorites.songs)
@@ -99,14 +105,25 @@ export default function FavoritesScreen() {
return (
<>
+
+ {songs.length ? "No songs found." : "No songs in this playlist."}
+
+ }
ListHeaderComponent={
{
+ const query = search.searchQuery.toLowerCase()
+ if (!query) return songs
+ return songs.filter((song) =>
+ [song.title, song.artist.name, song.album.title].some((value) =>
+ value.toLowerCase().includes(query)
+ )
+ )
+ }, [songs, search.searchQuery])
+
+ return { ...search, filteredSongs }
+}
+
+export function PlaylistSearchBar({
+ onQueryChange,
+ onSearchSubmit,
+}: Pick<
+ ReturnType,
+ "onQueryChange" | "onSearchSubmit"
+>) {
+ const colors = useThemeColors()
+ const handleChangeText = useCallback(
+ (event: { nativeEvent: { text: string } }) => {
+ onQueryChange(event.nativeEvent.text)
+ },
+ [onQueryChange]
+ )
+
+ return (
+
+ )
+}