Genesis
@stable

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/data
import { 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}`)} /> ```

PropTypeDefaultDescription
view*AnyResourceView<T>—
canNativeResourceScreenCan<T>—The screen's own rule. It only narrows the view's guards.
defaultSegmentstring—The segment the list opens on. Default the view's first.
emptyStateReactNode—Replaces the empty state.
enabledboolean—False while another type (a board, a calendar) draws the rows: the list reads nothing. Default true.
filterReadonly<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.
galleryPartial<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.
headerReactNode—Above the list, under the search (a filter, a call to action).
listFiltersreadonly FilterParam[]—The list state's filters (core `useListState`: a segment and the declared filters), on top of the screen's.
liveboolean—Refetch loaded pages when the provider reports a change.
maxPagesnumber—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.
modeenum—`"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.
numColumnsnumber—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.
perPagenumber—Rows per page. Default 25.
presetstring—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.
rowMenuComponentType<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.
savedViewsSavedViewStore—Where the person's choices (the view type) are kept: the app's saved-view store, the web's contract.
scopeTimeZonestring—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).
searchableboolean—Hide the search box. Shown by default when the view has something to search.
searchFieldsstring[]—Fields the search box searches. Default: the view's `labelField`.
subtitlestring—
swipeableComponentType<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.
switcherboolean—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`.
testIDstring—
titlestring | false—The heading above the list. Default the view's title; `false` when the navigation bar shows it.
typeenum—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.