import type { BaseItemPerson } from "@jellyfin/sdk/lib/generated-client/models"; import React from "react"; import { useTranslation } from "react-i18next"; import { ScrollView, TVFocusGuideView, View } from "react-native"; import { Text } from "@/components/common/Text"; import { useScaledTVSizes } from "@/constants/TVSizes"; import { useScaledTVTypography } from "@/constants/TVTypography"; import { TVActorCard } from "./TVActorCard"; export interface TVCastSectionProps { cast: BaseItemPerson[]; apiBasePath?: string; onActorPress: (personId: string) => void; /** Setter function for the first actor card ref (for focus guide) */ firstActorRefSetter?: (ref: View | null) => void; /** Ref to focus guide destination for upward navigation */ upwardFocusDestination?: View | null; } export const TVCastSection: React.FC = React.memo( ({ cast, apiBasePath, onActorPress, firstActorRefSetter, upwardFocusDestination, }) => { const typography = useScaledTVTypography(); const sizes = useScaledTVSizes(); const { t } = useTranslation(); if (cast.length === 0) { return null; } return ( {t("item_card.cast")} {/* Focus guide to direct upward navigation from cast back to options */} {upwardFocusDestination && ( )} {cast.map((person, index) => ( { if (person.Id) { onActorPress(person.Id); } }} /> ))} ); }, );