withZoomFocus

Returns a cell template that scales on focus via the grid tween primitive

import { withZoomFocus } from "@roku-sdk/flex-grid/zoom-focus";
withZoomFocus<T>(Cell: Component<CellRenderProps<T>>, options: ZoomFocusOptions): Component<CellRenderProps<T>>

Description

Returns a cell template that scales on focus via the grid tween primitive.

The wrapped template receives the same CellRenderProps (including focused) so it can draw its own outline or ignore focus.

Which templates zoom is decided here, when the registry is built; there is no per-row opt-out. A template that must decide at runtime should read props.row and apply its own scale instead of being wrapped.

Parameters

NameTypeDescription
CellComponent<CellRenderProps<T>>
optionsZoomFocusOptions

Return values

Returns Component<CellRenderProps<T>>.

Example

import { withZoomFocus } from "@roku-sdk/flex-grid/zoom-focus";

const PortraitCell = withZoomFocus(PortraitSimpleCell, {
  focusedScale: 1.0,
  unfocusedScale: 0.85,
});

Types

ZoomFocusOptions

Zoom Focus Options configuration and callbacks.

NameTypeDescription
durationSec?numberScale tween duration in seconds. Default: 0.25
focusedScale?numberScale factor when the cell has focus. Default: 1.0
idPrefix?stringPrefix for scaler-group SceneGraph ids; defaults to geZoom_${n} per wrapped template.
unfocusedScale?numberScale factor when the cell does not have focus. Default: 0.95

What’s Next

Did this page help you?