Files
sofa/apps/native/src/components/navigation/tab-stack.tsx
T
jake 78266cf202 feat(native): internationalize tab bar labels and improve recently-viewed row
- Wrap tab bar trigger labels and stack screen titles with `useLingui()` / `t` so they translate correctly across all 6 supported locales
- Swap `IconDeviceTv` → `IconDeviceTvOld` in the recently-viewed badge to match the icon used elsewhere in the app
- Show the type icon inside the pill badge and display a department label (Actor, Director, Writer, etc.) for person results instead of the generic "Person" / "TV" label
- Suppress the subtitle row for person results (department is shown in the badge instead)
- Merge the separate iOS/Android `headerTitleStyle` variables in `TabStack` into a single shared style
- Mark `packages/i18n/src/po/*` as readonly/excluded in VS Code settings alongside `routeTree.gen.ts`
- Extract and compile updated PO/TS catalogs for all locales (de, en, es, fr, it, pt)
2026-03-19 15:06:02 -04:00

80 lines
2.3 KiB
TypeScript

import { Stack } from "expo-router";
import type { ReactNode } from "react";
import { useCSSVariable, useResolveClassNames } from "uniwind";
import { HeaderAvatar } from "@/components/header-avatar";
export function TabStack({ title, children }: { title?: string; children?: ReactNode }) {
const contentStyle = useResolveClassNames("bg-background");
const tintColor = useCSSVariable("--color-primary") as string;
const backgroundColor = useCSSVariable("--color-background") as string;
const headerTitleStyle = useResolveClassNames("font-display text-foreground text-xl");
const headerLargeTitleStyle = useResolveClassNames("font-display text-foreground");
if (process.env.EXPO_OS === "ios") {
return (
<Stack
screenOptions={{
contentStyle,
unstable_headerRightItems: () => [
{
type: "custom" as const,
element: <HeaderAvatar />,
hidesSharedBackground: true,
},
],
}}
>
{title ? (
<Stack.Screen name="index">
<Stack.Header
transparent
blurEffect="systemChromeMaterialDark"
style={{ color: tintColor, shadowColor: "transparent" }}
largeStyle={{
backgroundColor: "transparent",
shadowColor: "transparent",
}}
/>
<Stack.Screen.Title
large
style={headerTitleStyle as Record<string, unknown>}
largeStyle={headerLargeTitleStyle as Record<string, unknown>}
>
{title}
</Stack.Screen.Title>
</Stack.Screen>
) : null}
{children}
</Stack>
);
}
return (
<Stack
screenOptions={{
contentStyle,
headerTitleAlign: "left",
headerRight: () => <HeaderAvatar />,
}}
>
{title ? (
<Stack.Screen name="index">
<Stack.Header
transparent={false}
style={{
backgroundColor,
color: tintColor,
shadowColor: "transparent",
}}
/>
<Stack.Screen.Title style={headerTitleStyle as Record<string, unknown>}>
{title}
</Stack.Screen.Title>
</Stack.Screen>
) : null}
{children}
</Stack>
);
}