Dedicated reference for the spatial navigation primitives exported by react-native-cross-elements.
| Property | Type | Description |
|---|---|---|
| children | ReactElement | (state: FocusableNodeState) => ReactElement | Content or render-prop with node state. |
| ...ViewProps | React Native View props | All view props except children. |
| ...SpatialNavigationNodeDefaultProps | - | Focus handlers plus orientation, grid alignment, index range, and additional offset. |
- Same as
FocusableViewPropsplus anodeStateobject injected bySpatialNavigationNode. - This is an internal helper type and usually does not need to be consumed directly.
| Property | Type | Default | Description |
|---|---|---|---|
| orientation | 'horizontal' | 'vertical' | 'vertical' | Orientation for spatial navigation direction. |
| onFocus | () => void | - | Called when the node receives focus. |
| onBlur | () => void | - | Called when the node loses focus. |
| onSelect | () => void | - | Called when the node is selected or pressed. |
| onLongSelect | () => void | - | Called when the node is long pressed. |
| onActive | () => void | - | Called when the node becomes active. |
| onInactive | () => void | - | Called when the node becomes inactive. |
| alignInGrid | boolean | false | Hint for grid alignment in LRUD navigation. |
| indexRange | [number, number] | - | Index range used by virtualized components. |
| additionalOffset | number | - | Extra scroll offset added during focus-driven scrolling. |
| Method | Signature | Description |
|---|---|---|
| focus | () => void | Imperatively focus the node. |
| Property / Method | Signature / Type | Description |
|---|---|---|
| focus | (index: number) => void | Focus an item at the given index. |
| scrollTo | (index: number) => void | Scroll to an item at the given index. |
| currentlyFocusedItemIndex | number | Last focused item index tracked by the list. |
- Alias of
SpatialNavigationVirtualizedListRef.
| Method | Signature | Description |
|---|---|---|
| getInnerViewNode | () => any | Returns the underlying scrollable node. |
| scrollTo | ({ x?, y?, animated }) => void | Scroll programmatically. |
| Property | Type | Description |
|---|---|---|
| horizontal | boolean | Horizontal scroll mode. |
| scrollDuration | number | Duration for CSS-based scrolling on web. |
| onScroll | (event: { nativeEvent: { contentOffset: { x: number; y: number } } }) => void | Scroll event callback. |
| ...ScrollViewProps | Omit<ScrollViewProps, 'onScroll' | 'onLayout'> | All other scroll view props. |
'horizontal' | 'vertical'
| Signature | Returns | Description |
|---|---|---|
({ currentlyFocusedItemIndex, vertical?, scrollDuration, scrollOffsetsArray }) |
Animated.WithAnimatedValue<ViewStyle> | Computes the animated style for list transitions. |
Top-level provider that enables spatial navigation, remote handling, and focus management.
| Prop | Type | Default | Description |
|---|---|---|---|
| isActive | boolean | true | Locks or unlocks the root. Set false to disable focus handling for an inactive screen. |
| onDirectionHandledWithoutMovement | (direction: 'up' | 'down' | 'left' | 'right') => void | - | Called when navigation reaches a border without moving focus. Useful for switching between sibling roots such as a side menu and page content. |
| children | ReactNode | required | Subtree controlled by this navigation root. |
Container that participates in spatial navigation when a root exists. Otherwise it falls back to a regular view.
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | required | Content to render. Can include focusable descendants. |
| direction | 'horizontal' | 'vertical' | 'horizontal' | Layout direction for arranging children. |
| alignInGrid | boolean | false | Hint to align focusable children as a grid. |
| ...ViewProps | Omit<ViewProps, 'children' | 'accessibilityState' | 'accessibilityRole'> | - | Pass-through view props. |
Scroll view that keeps the focused child visible while navigating with a remote or keyboard.
| Prop | Type | Default | Description |
|---|---|---|---|
| horizontal | boolean | false | Horizontal scroll direction. |
| offsetFromStart | number | 0 | Extra margin from the start edge when auto-scrolling to a focused element. |
| pointerScrollSpeed | number | 10 | Pixels scrolled every 10ms while hovering the arrow areas with a remote pointer. |
| useNativeScroll | boolean | false | Use native ScrollView instead of the CSS-based web implementation. |
| scrollDuration | number | 200 | Duration for CSS-based smooth scrolling on web. |
| ascendingArrow | ReactElement | - | Arrow rendered in the up or left control area. |
| descendingArrow | ReactElement | - | Arrow rendered in the down or right control area. |
| ascendingArrowContainerStyle | ViewStyle | - | Style for the up or left hover area. |
| descendingArrowContainerStyle | ViewStyle | - | Style for the down or right hover area. |
| ...CustomScrollViewProps | CustomScrollViewProps | - | All custom/native scroll view props. |
Focusable wrapper that renders a view and exposes node state to its children.
- See
FocusableViewPropsabove. - Use the render-prop form of
childrenwhen you needisFocused,isActive, orisRootActive.
Low-level focusable node used internally by SpatialNavigationFocusableView.
- Exposes focus lifecycle hooks and imperative focus via
SpatialNavigationNodeRef. - Accepts
SpatialNavigationNodeDefaultPropsplus either a focusable render-prop child or a non-focusable child.
Virtualized list integrated with spatial navigation.
- Exposes
focus(index)andscrollTo(index)throughSpatialNavigationVirtualizedListRef. - Tracks
currentlyFocusedItemIndexon the ref for consumers coordinating external state.
Virtualized grid variant exposing the same ref API as the list.
Marks a node as initially focused inside a subtree when the root activates.
Provider that detects whether the current interaction mode is pointer or remote-oriented and adapts focus behavior accordingly.