From aedb7bc51da524fd01e2ab22565236923aafb372 Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Sat, 30 May 2026 21:41:27 +0200 Subject: [PATCH] fix(tv): padding --- components/search/TVSearchSection.tsx | 12 ++++++++---- constants/TVSizes.ts | 8 +++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/components/search/TVSearchSection.tsx b/components/search/TVSearchSection.tsx index 5fd3dd37e..3d72de8df 100644 --- a/components/search/TVSearchSection.tsx +++ b/components/search/TVSearchSection.tsx @@ -20,6 +20,8 @@ interface TVSearchSectionProps extends ViewProps { onItemPress: (item: BaseItemDto) => void; onItemLongPress?: (item: BaseItemDto) => void; imageUrlGetter?: (item: BaseItemDto) => string | undefined; + /** Override the horizontal edge padding (defaults to the scaled TV padding). */ + horizontalPadding?: number; } export const TVSearchSection: React.FC = ({ @@ -31,12 +33,14 @@ export const TVSearchSection: React.FC = ({ onItemPress, onItemLongPress, imageUrlGetter, + horizontalPadding, ...props }) => { const typography = useScaledTVTypography(); const posterSizes = useScaledTVPosterSizes(); const sizes = useScaledTVSizes(); const ITEM_GAP = sizes.gaps.item; + const edgePadding = horizontalPadding ?? sizes.padding.horizontal; const flatListRef = useRef>(null); const [focusedCount, setFocusedCount] = useState(0); const prevFocusedCount = useRef(0); @@ -273,7 +277,7 @@ export const TVSearchSection: React.FC = ({ fontWeight: "700", color: "#FFFFFF", marginBottom: 20, - marginLeft: sizes.padding.horizontal, + marginLeft: edgePadding, letterSpacing: 0.5, }} > @@ -294,10 +298,10 @@ export const TVSearchSection: React.FC = ({ getItemLayout={getItemLayout} style={{ overflow: "visible" }} contentInset={{ - left: sizes.padding.horizontal, - right: sizes.padding.horizontal, + left: edgePadding, + right: edgePadding, }} - contentOffset={{ x: -sizes.padding.horizontal, y: 0 }} + contentOffset={{ x: -edgePadding, y: 0 }} contentContainerStyle={{ paddingVertical: SCALE_PADDING, }} diff --git a/constants/TVSizes.ts b/constants/TVSizes.ts index 0a9196c41..117609021 100644 --- a/constants/TVSizes.ts +++ b/constants/TVSizes.ts @@ -49,8 +49,8 @@ export const TVGaps = { * Base padding values in pixels. */ export const TVPadding = { - /** Horizontal padding from screen edges */ - horizontal: 90, + /** Horizontal padding from screen edges (static — matches native search inset) */ + horizontal: 80, /** Padding to accommodate scale animations (1.05x) */ scale: 20, @@ -142,7 +142,9 @@ export const useScaledTVSizes = (): ScaledTVSizes => { large: Math.round(scaleSize(TVGaps.large) * scale), }, padding: { - horizontal: Math.round(scaleSize(TVPadding.horizontal) * scale), + // Static: matches the native tvOS search bar inset, which is a fixed + // point value and does not change with the typography scale setting. + horizontal: TVPadding.horizontal, scale: Math.round(scaleSize(TVPadding.scale) * scale), vertical: Math.round(scaleSize(TVPadding.vertical) * scale), heroHeight: TVPadding.heroHeight * scale,