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>
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { useTabletLayout } from "@/hooks/use-tablet-layout"
|
|
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 LibraryLayout() {
|
|
const tabletLayout = useTabletLayout()
|
|
const baseOptions = useStackScreenOptions({ title: "Library" })
|
|
|
|
return (
|
|
<TabStackContext value="library">
|
|
<Stack
|
|
screenLayout={renderTabScreenContent}
|
|
screenOptions={({ route }) => ({
|
|
...baseOptions,
|
|
title:
|
|
tabStackScreenTitles[route.name] ??
|
|
(tabletLayout ? "Recently Added" : "Library"),
|
|
headerRight:
|
|
route.name === "index" ? () => <ProfileHeaderButton /> : undefined,
|
|
unstable_headerRightItems:
|
|
route.name === "index"
|
|
? () => [
|
|
{
|
|
type: "custom",
|
|
element: <ProfileHeaderButton />,
|
|
hidesSharedBackground: true,
|
|
},
|
|
]
|
|
: undefined,
|
|
})}
|
|
/>
|
|
</TabStackContext>
|
|
)
|
|
}
|