NativeResourceView
A native list screen from a view: ```tsx <NativeResourceView view={brandsView} onRowPress={(b) => router.push(`/brands/${b.id}`)} /> ```
packages/ui-native/src/data/resource-view/NativeResourceView.tsx
Import
Subpath export:
@marktiderman/genesis-ui-native/dataimport { NativeResourceView } from "@marktiderman/genesis-ui-native/data";Components
Auto-generated from TypeScript source via
react-docgen-typescript.NativeResourceView
A native list screen from a view: ```tsx <NativeResourceView view={brandsView} onRowPress={(b) => router.push(`/brands/${b.id}`)} /> ```
| Prop | Type | Default | Description |
|---|---|---|---|
| view* | AnyResourceView<T> | — | |
| can | NativeResourceScreenCan<T> | — | The screen's own rule. It only narrows the view's guards. |
| defaultSegment | string | — | The segment the list opens on. Default the view's first. |
| emptyState | ReactNode | — | Replaces the empty state. |
| enabled | boolean | — | False while another type (a board, a calendar) draws the rows: the list reads nothing. Default true. |
| filter | Readonly<Record<string, string | number | boolean | readonly (string | number)[] | null>> | — | Filters sent to the server (`{ client_id: id }`); `null` means "is empty" and a list means "any of" (`{ status: ["open", "blocked"] }`, sent as `in`; a create never takes a list). A create also saves every non-null value here (a tab's filter too), even for read-only fields such as a required link: they come from the screen, never from an input. An edit never sends them. |
| gallery | Partial<ViewGallery<string>> | — | With `mode="grid"`: overrides the view's `gallery` block, or adds one. With a gallery, grid mode draws a photo per row in justified rows (NativeGalleryGrid, the web's layout) in place of cards; a row without an image is a placeholder tile, and a press opens the row as a card's does. |
| header | ReactNode | — | Above the list, under the search (a filter, a call to action). |
| listFilters | readonly FilterParam[] | — | The list state's filters (core `useListState`: a segment and the declared filters), on top of the screen's. |
| live | boolean | — | Refetch loaded pages when the provider reports a change. |
| maxPages | number | — | Pages kept loaded when the provider pages by cursor (and serves `prevCursor`): scrolling far drops pages from the front, and scrolling back to the top loads them again (`loadPrevious` on the list's `onStartReached`, with `maintainVisibleContentPosition` so the rows on screen stay put). Offset paging never drops pages. Default 10. |
| mode | enum | — | `"grid"`: cards in `numColumns` columns, as the web's `mode="grid"`. Sections, paging, pull to refresh, the empty and error states, long press, accessibility and swipe actions all stay. Default `"list"`. Prefer `type`; `mode` stays as its alias. |
| numColumns | number | — | Columns in grid mode (React Native's FlatList name). Default 2. |
| onAction | ((name: string, row: T) => void | Promise<void>) | — | Runs one of the view's actions on a row (a swipe or the long-press menu). Default: the provider's `runAction`, after the action's `confirm`. |
| onRowPress | ((row: T) => void) | — | A row was pressed: push its detail route (`router.push(\`/brands/${row.id}\`)`), so deep links and notification taps land on the same screen. Without it, a press opens a peek sheet. |
| perPage | number | — | Rows per page. Default 25. |
| preset | string | — | A tab the view defines: its server filter. |
| renderCard | ((row: T, index: number, card: NativeResourceCardActions) => ReactNode) | — | Draws each row (list) or card (grid) yourself, as the web's `renderCard`. Spread `card.pressableProps` on your Pressable for the press, long press and accessibility; the screen still wraps it in `swipeable`. It owns the whole row: no inset group cell or separator is drawn around it. `index` is the row's place in its section. Pass a stable function (`useCallback`) so rows redraw only when their data does. |
| rowMenu | ComponentType<RowActionsMenuProps> | — | The `"inbox"` type's rows: a long-press menu of the screen's own, in place of the sheet and the system menu (InboxPage's `rowMenu` slot). The swipe and the screen reader's actions stay. |
| savedViews | SavedViewStore | — | Where the person's choices (the view type) are kept: the app's saved-view store, the web's contract. |
| scopeTimeZone | string | — | The IANA zone of whatever this screen is scoped to (a location, a league, a team), for columns with `timeZone: "scope"`. Default: ViewerScope's `scopeTimeZone`, else the viewer's clock. Timestamps on other columns read on the viewer's clock (ViewerScope's zone, else the device's). |
| searchable | boolean | — | Hide the search box. Shown by default when the view has something to search. |
| searchFields | string[] | — | Fields the search box searches. Default: the view's `labelField`. |
| subtitle | string | — | |
| swipeable | ComponentType<NativeResourceSwipeableProps> | null | — | Wraps each row that has actions in a swipe gesture. Default `NativeSwipeRow` (which swipes once the app passes `GenesisModules.swipeable`) on list rows: Edit and Delete trailing, and the view's actions where their `swipe` says (ADR 0028), at most three a side. Grid cards and `renderCard` rows swipe only with a `swipeable` of the screen's own. `null` turns it off. |
| switcher | boolean | — | The view-type switcher above the list (ADR 0017 §11): the view's `types` the phone draws, the person's choice kept in `savedViews`. Default on when the view declares `types` (two or more the phone draws) and the screen fixes neither `type` nor `mode`. |
| testID | string | — | |
| title | string | false | — | The heading above the list. Default the view's title; `false` when the navigation bar shows it. |
| type | enum | — | The view type (ADR 0021), as the web's `<ResourceView type>`: `"list"` (default), `"grid"`, or `"gallery"` (the grid as photos, from the view's `gallery` block), or `"inbox"` (InboxPage's rows from the view's `inbox` block: unread in bold, a preview, a time, swipe actions), `"board"` (the view's board block: columns side by side, a long press moves a card) or `"calendar"` (the view's calendar block: an agenda or a month). Wins over `mode`, and fixes the type: the switcher stays off unless `switcher` asks for it. |
gridLines
A section's loaded rows cut into grid lines of `numColumns`, `above` of its rows being above the loaded window. A line whose rows haven't changed is the same object as last time (`previous`), so its memoised GridRow skips the redraw.
No declared props.