Files
otunes/apps/mobile/app/(app)/(tabs)/search/_layout.tsx
T
joshuafhigginsandClaude Opus 5.5 Verified 2c6709d2ac fix(mobile): open library albums in the library tab
Album cards built their link from a global active-tab ref read at render
time. Cards on the library page could render before the ref caught up with
the tab switch, so their links pointed at the home tab. Each tab stack now
provides its own tab through context, and navigation resolves against it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 02:00:36 -05:00

39 lines
1.2 KiB
TypeScript

import { renderTabScreenContent } from "@/components/tab-screen-content"
import { Stack } from "expo-router"
import { TabStackContext } from "@/lib/app-navigation"
import { ProfileHeaderButton } from "@/components/profile-header-button"
import { tabStackScreenTitles, useStackScreenOptions } from "@/lib/navigation"
export const unstable_settings = {
anchor: "index",
}
export default function SearchLayout() {
const baseOptions = useStackScreenOptions({ title: "Search" })
return (
<TabStackContext value="search">
<Stack
screenLayout={renderTabScreenContent}
screenOptions={({ route }) => ({
...baseOptions,
title: tabStackScreenTitles[route.name] ?? "Search",
headerRight:
route.name === "index" ? () => <ProfileHeaderButton /> : undefined,
unstable_headerRightItems:
route.name === "index"
? () => [
{
type: "custom",
element: <ProfileHeaderButton />,
hidesSharedBackground: true,
},
]
: undefined,
})}
/>
</TabStackContext>
)
}