Skip to content

Commit

Permalink
feat: add alignInGrid to SpatialNavigationView
Browse files Browse the repository at this point in the history
  • Loading branch information
remilry committed Feb 19, 2024
1 parent 43b091b commit b496427
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ The `SpatialNavigationView` component receives the following props:
| Name | Type | Default | Description |
| ----------- | ---------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------- |
| `direction` | `'horizontal' \| 'vertical'` | `'horizontal'` | The orientation of the `SpatialNavigationNode`. |
| `alignInGrid` | `boolean` | `false` | Determines whether child lists should behave like a grid. | |
| `style` | `ViewStyle` | `null` | Style for the View. This can be any valid React Native style object. |
| `children` | `ReactNode` | `null` | Child elements of the component. They are expected to be one or multiple `SpatialNavigationNode` elements. |

Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/spatial-navigation/components/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ import { SpatialNavigationNode } from './Node';

export const SpatialNavigationView = ({
direction = 'horizontal',
alignInGrid = false,
children,
style,
}: {
children: React.ReactNode;
style?: ViewStyle;
direction: 'horizontal' | 'vertical';
alignInGrid?: boolean;
}) => {
return (
<SpatialNavigationNode orientation={direction}>
<SpatialNavigationNode orientation={direction} alignInGrid={alignInGrid}>
<View
style={[style, direction === 'horizontal' ? styles.viewHorizontal : styles.viewVertical]}
>
Expand Down

0 comments on commit b496427

Please sign in to comment.