fix(tv): keep "See All" detail stable and Back returning to library list

The home "See All" detail opens in the libraries tab. When that tab already
had its index in the stack (e.g. after a previous See All + Back), the stack
became [index, detail], which the native bottom tab reliably auto-popped back
to index — the detail "bounced" to the library list ~0.5s after opening.

- Pass a `fromSeeAll` flag from the See All button.
- On the detail page, collapse the libraries stack to [detail] when deep-linked
  on top of the index, so the native tab has nothing to auto-pop to.
- Intercept TV Back (while focused) to route to the library list so the user
  can switch libraries, instead of exiting the tab to home.

Claude-Session: https://claude.ai/code/session_016Hhu5DruGLPhdP4LAoy1Xd
This commit is contained in:
Fredrik Burmester
2026-06-30 10:30:36 +02:00
parent d17c620b65
commit 40cb8fed9e
2 changed files with 48 additions and 7 deletions

View File

@@ -201,16 +201,18 @@ export const InfiniteScrollingCollectionList: React.FC<Props> = ({
const handleSeeAllPress = useCallback(() => {
if (!parentId) return;
// Use the relative "/[libraryId]" pathname (same as getItemNavigation) so the
// library detail is pushed within the current tab's stack. The fully-qualified
// "/(auth)/(tabs)/(libraries)/[libraryId]" path is a cross-tab navigation that
// only switches to the libraries tab and drops the nested screen push.
// Navigate into the library detail (lives in the libraries tab) sorted by most
// recently added. The `fromSeeAll` flag tells the detail page to (a) collapse
// the libraries stack so the native tab can't auto-pop it back to the list, and
// (b) intercept Back to route to the library list so the user can switch
// libraries. See app/(auth)/(tabs)/(libraries)/[libraryId].tsx.
router.push({
pathname: "/[libraryId]",
params: {
libraryId: parentId,
sortBy: SortByOption.DateCreated,
sortOrder: SortOrderOption.Descending,
fromSeeAll: "true",
},
} as any);
}, [router, parentId]);