feat(mobile): inline title on the Search tab, keep stacked search bars

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
joshuafhigginsandClaude Opus 5.5 committed 2026-11-20 00:12:58 -05:00 Verified
1 parent 92ecb1f794
commit dc30fb38f8
6 files changed
+24 -25

No files matched your search

@@ -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",
},
}}
/>
@@ -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",
},
}}
/>
@@ -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",
},
}}
/>
@@ -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" ? () => <ProfileHeaderButton /> : undefined,
@@ -35,7 +35,7 @@ export default function SearchScreen() {
: {})}
/>
<SearchResults searchQuery={searchQuery} />
<SearchResults searchQuery={searchQuery} title="Search" />
</>
)
}
+22 -13
View File
@@ -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<FlatList<BrowseSong>>()
const { playFromSong } = usePlaybackActions()
const { isSongFavorite } = useFavorites()
const { handleSongAction } = useMediaMenuActions()
@@ -76,16 +86,14 @@ function SearchResultsBody({ searchQuery }: { searchQuery: string }) {
)
if (isSearching) {
return <SongListSkeleton />
}
if (!hasQuery) {
return <></>
return <SongListSkeleton title={title} />
}
return (
<FlatList
data={results?.songs ?? []}
<Animated.FlatList
ref={ref}
scrollEventThrottle={16}
data={hasQuery ? (results?.songs ?? []) : []}
keyExtractor={(song) => song.id}
style={{ flex: 1, backgroundColor: colors.background }}
contentContainerStyle={{ paddingBottom: tabContentBottomInset }}
@@ -93,7 +101,8 @@ function SearchResultsBody({ searchQuery }: { searchQuery: string }) {
keyboardShouldPersistTaps="handled"
ListHeaderComponent={
<>
{!hasResults ? (
<ScreenTitle title={title} scrollY={scrollY} />
{hasQuery && !hasResults ? (
<View style={styles.empty}>
<Text
style={[styles.emptyText, { color: colors.mutedForeground }]}
@@ -103,13 +112,13 @@ function SearchResultsBody({ searchQuery }: { searchQuery: string }) {
</View>
) : null}
{results?.artists.length ? (
{hasQuery && results?.artists.length ? (
<View style={styles.section}>
<ContentCarousel title="Artists" content={results.artists} />
</View>
) : null}
{results?.albums.length ? (
{hasQuery && results?.albums.length ? (
<View style={styles.section}>
<ContentCarousel title="Albums" content={results.albums} />
</View>
@@ -118,7 +127,7 @@ function SearchResultsBody({ searchQuery }: { searchQuery: string }) {
}
renderItem={renderItem}
ListFooterComponent={
playlistResults && playlistResults.length > 0 ? (
hasQuery && playlistResults && playlistResults.length > 0 ? (
<View style={styles.section}>
<ContentCarousel title="Playlists" content={playlistResults} />
</View>