diff --git a/apps/mobile/app/(app)/(tabs)/home/browse/albums.tsx b/apps/mobile/app/(app)/(tabs)/home/browse/albums.tsx index 297c5dd..b1cae32 100644 --- a/apps/mobile/app/(app)/(tabs)/home/browse/albums.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/browse/albums.tsx @@ -44,8 +44,6 @@ export default function AlbumsScreen() { placeholder: "Search", onChangeText: handleChangeText, onSearchButtonPress: onSearchSubmit, - // A search button in the bar leaves room for the inline title. - placement: "integratedButton", }, }} /> diff --git a/apps/mobile/app/(app)/(tabs)/home/browse/artists.tsx b/apps/mobile/app/(app)/(tabs)/home/browse/artists.tsx index 2bc57ff..ae5b13d 100644 --- a/apps/mobile/app/(app)/(tabs)/home/browse/artists.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/browse/artists.tsx @@ -88,8 +88,6 @@ export default function ArtistsScreen() { placeholder: "Search", onChangeText: handleChangeText, onSearchButtonPress: onSearchSubmit, - // A search button in the bar leaves room for the inline title. - placement: "integratedButton", }, }} /> diff --git a/apps/mobile/app/(app)/(tabs)/home/browse/songs.tsx b/apps/mobile/app/(app)/(tabs)/home/browse/songs.tsx index c629f2a..15065ca 100644 --- a/apps/mobile/app/(app)/(tabs)/home/browse/songs.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/browse/songs.tsx @@ -85,8 +85,6 @@ export default function SongsScreen() { placeholder: "Search", onChangeText: handleChangeText, onSearchButtonPress: onSearchSubmit, - // A search button in the bar leaves room for the inline title. - placement: "integratedButton", }, }} /> diff --git a/apps/mobile/app/(app)/(tabs)/search/_layout.tsx b/apps/mobile/app/(app)/(tabs)/search/_layout.tsx index 9ac88d6..688b642 100644 --- a/apps/mobile/app/(app)/(tabs)/search/_layout.tsx +++ b/apps/mobile/app/(app)/(tabs)/search/_layout.tsx @@ -20,11 +20,7 @@ export default function SearchLayout() { screenLayout={renderTabScreenContent} screenOptions={({ route }) => ({ ...baseOptions, - // The search tab keeps the native large title: its header search - // field has to sit below the title, which an inline title can't do. - ...(route.name === "index" - ? { headerLargeTitle: true } - : inlineTitleOptions), + ...inlineTitleOptions, title: tabStackScreenTitles[route.name] ?? "Search", headerRight: route.name === "index" ? () => : undefined, diff --git a/apps/mobile/app/(app)/(tabs)/search/index.tsx b/apps/mobile/app/(app)/(tabs)/search/index.tsx index 1dc5e39..6804298 100644 --- a/apps/mobile/app/(app)/(tabs)/search/index.tsx +++ b/apps/mobile/app/(app)/(tabs)/search/index.tsx @@ -35,7 +35,7 @@ export default function SearchScreen() { : {})} /> - + ) } diff --git a/apps/mobile/components/search-results.tsx b/apps/mobile/components/search-results.tsx index 9501421..d81d92e 100644 --- a/apps/mobile/components/search-results.tsx +++ b/apps/mobile/components/search-results.tsx @@ -1,13 +1,15 @@ import { memo, useCallback, useMemo } from "react" import { - FlatList, + type FlatList, StyleSheet, Text, View, type ListRenderItemInfo, } from "react-native" +import Animated from "react-native-reanimated" import { ContentCarousel } from "@/components/media-cards" +import { ScreenTitle, useScreenTitleScroll } from "@/components/screen-title" import type { MediaAction } from "@/components/media-context-menu" import { tabContentBottomInset, SongListRow } from "@/components/player" import { SongListSkeleton } from "@/components/skeletons" @@ -19,8 +21,16 @@ import { api } from "@otunes/convex/_generated/api" import type { BrowseSong, SearchSong } from "@otunes/convex/types" import { spacing, useThemeColors } from "@/lib/theme" -function SearchResultsBody({ searchQuery }: { searchQuery: string }) { +function SearchResultsBody({ + searchQuery, + title, +}: { + searchQuery: string + /** iOS `ScreenTitle`, shown above the results and while idle. */ + title: string +}) { const colors = useThemeColors() + const { ref, scrollY } = useScreenTitleScroll>() const { playFromSong } = usePlaybackActions() const { isSongFavorite } = useFavorites() const { handleSongAction } = useMediaMenuActions() @@ -76,16 +86,14 @@ function SearchResultsBody({ searchQuery }: { searchQuery: string }) { ) if (isSearching) { - return - } - - if (!hasQuery) { - return <> + return } return ( - song.id} style={{ flex: 1, backgroundColor: colors.background }} contentContainerStyle={{ paddingBottom: tabContentBottomInset }} @@ -93,7 +101,8 @@ function SearchResultsBody({ searchQuery }: { searchQuery: string }) { keyboardShouldPersistTaps="handled" ListHeaderComponent={ <> - {!hasResults ? ( + + {hasQuery && !hasResults ? ( ) : null} - {results?.artists.length ? ( + {hasQuery && results?.artists.length ? ( ) : null} - {results?.albums.length ? ( + {hasQuery && results?.albums.length ? ( @@ -118,7 +127,7 @@ function SearchResultsBody({ searchQuery }: { searchQuery: string }) { } renderItem={renderItem} ListFooterComponent={ - playlistResults && playlistResults.length > 0 ? ( + hasQuery && playlistResults && playlistResults.length > 0 ? (