From 92ecb1f79443021dda1e87fa666dc74549535b5e Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Fri, 20 Nov 2026 00:09:30 -0500 Subject: [PATCH 1/2] feat(mobile): scroll-away inline screen titles on iOS Co-Authored-By: Claude Opus 5.5 --- .../_layout.tsx | 7 +- apps/mobile/app/(app)/(tabs)/home/_layout.tsx | 7 +- .../app/(app)/(tabs)/home/browse/albums.tsx | 5 +- .../app/(app)/(tabs)/home/browse/artists.tsx | 14 +++- .../(app)/(tabs)/home/browse/playlists.tsx | 12 +-- .../app/(app)/(tabs)/home/browse/songs.tsx | 18 +++- .../app/(app)/(tabs)/home/downloads/index.tsx | 20 ++++- .../app/(app)/(tabs)/home/downloads/other.tsx | 58 +++++++------ apps/mobile/app/(app)/(tabs)/home/index.tsx | 20 ++++- .../app/(app)/(tabs)/home/recently-added.tsx | 3 +- .../app/(app)/(tabs)/home/recently-played.tsx | 3 +- .../app/(app)/(tabs)/library/_layout.tsx | 7 +- .../mobile/app/(app)/(tabs)/library/index.tsx | 10 ++- .../app/(app)/(tabs)/search/_layout.tsx | 11 ++- apps/mobile/components/media-cards.tsx | 27 +++++- apps/mobile/components/screen-title.tsx | 84 +++++++++++++++++++ apps/mobile/components/skeletons.tsx | 54 ++++++++++-- apps/mobile/components/tablet-media-grid.tsx | 25 ++++-- apps/mobile/lib/navigation.ts | 9 +- 19 files changed, 330 insertions(+), 64 deletions(-) create mode 100644 apps/mobile/components/screen-title.tsx diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent,downloads)/_layout.tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent,downloads)/_layout.tsx index 9453ea3..917c410 100644 --- a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent,downloads)/_layout.tsx +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent,downloads)/_layout.tsx @@ -1,7 +1,11 @@ import { Stack } from "expo-router" import { renderTabScreenContent } from "@/components/tab-screen-content" -import { useStackScreenOptions, tabStackScreenTitles } from "@/lib/navigation" +import { + inlineTitleOptions, + tabStackScreenTitles, + useStackScreenOptions, +} from "@/lib/navigation" import { tabletSections, TabletSectionContext } from "@/lib/tablet-navigation" export default function TabletSectionLayout({ segment }: { segment: string }) { @@ -14,6 +18,7 @@ export default function TabletSectionLayout({ segment }: { segment: string }) { screenLayout={renderTabScreenContent} screenOptions={({ route }) => ({ ...options, + ...inlineTitleOptions, title: route.name === "index" ? section?.title diff --git a/apps/mobile/app/(app)/(tabs)/home/_layout.tsx b/apps/mobile/app/(app)/(tabs)/home/_layout.tsx index 75da6ca..7d17397 100644 --- a/apps/mobile/app/(app)/(tabs)/home/_layout.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/_layout.tsx @@ -2,7 +2,11 @@ import { renderTabScreenContent } from "@/components/tab-screen-content" import { Stack } from "expo-router" import { ProfileHeaderButton } from "@/components/profile-header-button" -import { tabStackScreenTitles, useStackScreenOptions } from "@/lib/navigation" +import { + inlineTitleOptions, + tabStackScreenTitles, + useStackScreenOptions, +} from "@/lib/navigation" export const unstable_settings = { anchor: "index", @@ -16,6 +20,7 @@ export default function HomeLayout() { screenLayout={renderTabScreenContent} screenOptions={({ route }) => ({ ...baseOptions, + ...inlineTitleOptions, title: tabStackScreenTitles[route.name] ?? "Home", headerRight: route.name === "index" ? () => : undefined, diff --git a/apps/mobile/app/(app)/(tabs)/home/browse/albums.tsx b/apps/mobile/app/(app)/(tabs)/home/browse/albums.tsx index 21da78d..297c5dd 100644 --- a/apps/mobile/app/(app)/(tabs)/home/browse/albums.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/browse/albums.tsx @@ -44,6 +44,8 @@ export default function AlbumsScreen() { placeholder: "Search", onChangeText: handleChangeText, onSearchButtonPress: onSearchSubmit, + // A search button in the bar leaves room for the inline title. + placement: "integratedButton", }, }} /> @@ -53,7 +55,7 @@ export default function AlbumsScreen() { return ( <> {searchBar} - + ) } @@ -63,6 +65,7 @@ export default function AlbumsScreen() { {searchBar} { diff --git a/apps/mobile/app/(app)/(tabs)/home/browse/artists.tsx b/apps/mobile/app/(app)/(tabs)/home/browse/artists.tsx index b83ea1f..2bc57ff 100644 --- a/apps/mobile/app/(app)/(tabs)/home/browse/artists.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/browse/artists.tsx @@ -2,12 +2,13 @@ import { Ionicons } from "@expo/vector-icons" import { Stack } from "expo-router" import { memo, useCallback } from "react" import { - FlatList, + type FlatList, Pressable, StyleSheet, Text, type ListRenderItemInfo, } from "react-native" +import Animated from "react-native-reanimated" import { MediaContextMenu, @@ -15,6 +16,7 @@ import { } from "@/components/media-context-menu" import { CoverImage } from "@/components/cover-image" import { ArtistListSkeleton } from "@/components/skeletons" +import { ScreenTitle, useScreenTitleScroll } from "@/components/screen-title" import { contentBottomInset } from "@/components/player" import { useServerConfig } from "@/contexts/server-config" import { @@ -33,6 +35,7 @@ import { spacing, useThemeColors } from "@/lib/theme" const PAGE_SIZE = 50 export default function ArtistsScreen() { + const { ref, scrollY } = useScreenTitleScroll>() const { push } = useAppNavigation() const colors = useThemeColors() const { config } = useServerConfig() @@ -85,6 +88,8 @@ export default function ArtistsScreen() { placeholder: "Search", onChangeText: handleChangeText, onSearchButtonPress: onSearchSubmit, + // A search button in the bar leaves room for the inline title. + placement: "integratedButton", }, }} /> @@ -94,7 +99,7 @@ export default function ArtistsScreen() { return ( <> {searchBar} - + ) } @@ -103,8 +108,11 @@ export default function ArtistsScreen() { <> {searchBar} - } data={artists} keyExtractor={artistKey} renderItem={renderItem} diff --git a/apps/mobile/app/(app)/(tabs)/home/browse/playlists.tsx b/apps/mobile/app/(app)/(tabs)/home/browse/playlists.tsx index d8f2aab..ca36163 100644 --- a/apps/mobile/app/(app)/(tabs)/home/browse/playlists.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/browse/playlists.tsx @@ -1,3 +1,4 @@ +import { useContext } from "react" import { Pressable } from "react-native" import { MediaGridList } from "@/components/media-cards" @@ -10,19 +11,20 @@ import { Ionicons } from "@expo/vector-icons" import { Stack } from "expo-router" import { SymbolView } from "expo-symbols" import { useAddToPlaylist } from "@/contexts/add-to-playlist" +import { TabletSectionContext } from "@/lib/tablet-navigation" export default function PlaylistsTabScreen() { const colors = useThemeColors() const playlists = useCachedQuery(api.playlists.listAllPlaylists) const { openCreatePlaylist } = useAddToPlaylist() + const title = useContext(TabletSectionContext)?.title ?? "Playlists" if (playlists === undefined) { return ( <> ( - + ) } @@ -47,8 +49,7 @@ export default function PlaylistsTabScreen() { <> ( diff --git a/apps/mobile/app/(app)/(tabs)/home/browse/songs.tsx b/apps/mobile/app/(app)/(tabs)/home/browse/songs.tsx index 204c67a..c629f2a 100644 --- a/apps/mobile/app/(app)/(tabs)/home/browse/songs.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/browse/songs.tsx @@ -1,10 +1,16 @@ import { Stack } from "expo-router" import { useCallback, useState } from "react" -import { FlatList, StyleSheet, type ListRenderItemInfo } from "react-native" +import { + type FlatList, + StyleSheet, + type ListRenderItemInfo, +} from "react-native" +import Animated from "react-native-reanimated" import type { MediaAction } from "@/components/media-context-menu" import { contentBottomInset, SongListRow } from "@/components/player" import { SongListSkeleton } from "@/components/skeletons" +import { ScreenTitle, useScreenTitleScroll } from "@/components/screen-title" import { useFavorites } from "@/contexts/favorites" import { usePlaybackActions } from "@/contexts/playback" import { @@ -20,6 +26,7 @@ import { longListProps } from "@/lib/list" const PAGE_SIZE = 50 export default function SongsScreen() { + const { ref, scrollY } = useScreenTitleScroll>() const { playFromLibrarySong } = usePlaybackActions() const { isSongFavorite } = useFavorites() const { handleSongAction } = useMediaMenuActions() @@ -78,6 +85,8 @@ export default function SongsScreen() { placeholder: "Search", onChangeText: handleChangeText, onSearchButtonPress: onSearchSubmit, + // A search button in the bar leaves room for the inline title. + placement: "integratedButton", }, }} /> @@ -87,7 +96,7 @@ export default function SongsScreen() { return ( <> {searchBar} - + ) } @@ -96,8 +105,11 @@ export default function SongsScreen() { <> {searchBar} - } data={songs} keyExtractor={songKey} renderItem={renderItem} diff --git a/apps/mobile/app/(app)/(tabs)/home/downloads/index.tsx b/apps/mobile/app/(app)/(tabs)/home/downloads/index.tsx index 5880bdc..f19f8f7 100644 --- a/apps/mobile/app/(app)/(tabs)/home/downloads/index.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/downloads/index.tsx @@ -1,6 +1,6 @@ import { useMemo } from "react" import { - FlatList, + type FlatList, Pressable, StyleSheet, Text, @@ -8,8 +8,10 @@ import { type ListRenderItemInfo, } from "react-native" import { Stack } from "expo-router" +import Animated from "react-native-reanimated" import { CoverImage } from "@/components/cover-image" +import { ScreenTitle, useScreenTitleScroll } from "@/components/screen-title" import { tabContentBottomInset } from "@/components/player" import { FAVORITES_DOWNLOAD_ID, @@ -53,6 +55,7 @@ export default function DownloadsScreen() { const { push } = useAppNavigation() const { columns, cardWidth, onLayout, horizontalPadding, gap } = useMediaGridLayout() + const { ref, scrollY } = useScreenTitleScroll>() const cards = useMemo(() => { if (!queue) return [] @@ -135,8 +138,10 @@ export default function DownloadsScreen() { return ( <> - - + 1 ? { gap } : undefined} contentInsetAdjustmentBehavior="automatic" + ListHeaderComponent={ + + } ListEmptyComponent={ diff --git a/apps/mobile/app/(app)/(tabs)/home/downloads/other.tsx b/apps/mobile/app/(app)/(tabs)/home/downloads/other.tsx index 80599f2..1713185 100644 --- a/apps/mobile/app/(app)/(tabs)/home/downloads/other.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/downloads/other.tsx @@ -1,15 +1,17 @@ import { useCallback, useMemo } from "react" import { - FlatList, + type FlatList, Pressable, StyleSheet, Text, View, type ListRenderItemInfo, } from "react-native" +import Animated from "react-native-reanimated" import { Ionicons } from "@expo/vector-icons" import { Stack } from "expo-router" +import { ScreenTitle, useScreenTitleScroll } from "@/components/screen-title" import { useSwipeRowGroup } from "@/components/ios-swipe-to-remove-row" import type { MediaAction } from "@/components/media-context-menu" import { contentBottomInset, SongListRow } from "@/components/player" @@ -52,6 +54,7 @@ export default function OtherDownloadsScreen() { const { isSongFavorite } = useFavorites() const { handleSongAction } = useMediaMenuActions() const swipeGroup = useSwipeRowGroup() + const { ref, scrollY } = useScreenTitleScroll>() const handlePlaySong = useCallback( (song: BrowseSong) => void playFromSong(song.id, playableIds, PLAY_ORIGIN), @@ -90,11 +93,11 @@ export default function OtherDownloadsScreen() { return ( <> - - + song.id} renderItem={renderItem} @@ -103,25 +106,32 @@ export default function OtherDownloadsScreen() { contentInsetAdjustmentBehavior="automatic" onScrollBeginDrag={swipeGroup.closeOpenRow} ListHeaderComponent={ - songs.length > 0 ? ( - -