SettingsSubPage
SettingsSubPage — drill-in detail layout. Composes a KeyboardAvoidingView + scroll + dirty-form leave warning + optimistic-save pattern. The save action is surfaced in the nav bar via a `<NavBarSaveButton>` rendered through `headerRight`. Why ship: the recurring shape is "form fields + nav-bar Save + leave guard"; consumers re-implement this every time. Genesis ships the shape so consumers focus on the form fields themselves. Layer-3 customization: pass `headerTitle`, `headerLeft`, OR a direct `headerOptions={...}`. Use `getSettingsSubPageStackOptions()` to get a `<Stack.Screen options={...}>` object (with the save button wired via `headerRight`).
packages/ui-native/src/layouts/settings-sub-page.tsx
@marktiderman/genesis-ui-nativeimport { SettingsSubPage } from "@marktiderman/genesis-ui-native";react-docgen-typescript.confirmDiscardChanges
Default leave-guard helper. Pops a native Alert with Discard / Keep Editing buttons; calls `proceed()` only if the user opts to discard. <SettingsSubPage onConfirmLeave={confirmDiscardChanges} ... />
No declared props.
getSettingsSubPageStackOptions
Compose `<Stack.Screen options={...}>` for a SettingsSubPage. Wires the nav-bar Save button via `headerRight` automatically when `onSave` is passed.
| Prop | Type | Default | Description |
|---|---|---|---|
| dirty | boolean | — | |
| headerLeft | (() => ReactNode) | — | |
| headerOptions | Record<string, unknown> | — | |
| headerRight | (() => ReactNode) | — | |
| headerTitle | string | — | |
| large | boolean | — | |
| onSave | (() => void | Promise<void>) | — | |
| saveLabel | string | — | |
| saving | boolean | — | |
| scrollEdgeBehavior | enum | — |
SettingsSubPage
| Prop | Type | Default | Description |
|---|---|---|---|
| children* | ReactNode | — | Form / detail body content. Pass any node tree. |
| className | string | — | Override root container styling. |
| dirty | boolean | — | When true, the Save button is enabled and the back-confirm guard fires when the user tries to leave. Mark `true` whenever the form has unsaved changes. |
| headerLeft | (() => ReactNode) | — | Custom node rendered on the left of the nav bar. |
| headerLeftItems | (() => readonly unknown[]) | — | Native header items on the left (`unstable_headerLeftItems`). |
| headerOptions | Record<string, unknown> | — | Direct passthrough merged INTO the resolved options object. Wins over named props. |
| headerRight | (() => ReactNode) | — | Custom node rendered on the right of the nav bar. |
| headerRightItems | (() => readonly unknown[]) | — | Native header items on the right (react-native-screens' `unstable_headerRightItems`): bar buttons and menus drawn by UIKit, with iOS 26's glass grouping. Prefer them to `headerRight`. |
| headerTitle | string | — | Custom header title. Falls back to `<Stack.Screen name>` mapping. |
| large | boolean | — | When true, iOS uses large-title mode + scroll-edge appearance. |
| onConfirmLeave | ((proceed: () => void) => void) | null | — | Confirm-leave hook. Implementations should integrate with the navigator's `beforeRemove` listener (React Navigation) — Genesis provides a default `Alert` confirm helper via `confirmDiscardChanges()`. Pass null to opt OUT of the leave guard. |
| onSave | (() => void | Promise<void>) | — | Save handler. Required to render a Save button in the nav bar. |
| saveLabel | string | — | Save button label. Default `"Save"`. |
| saving | boolean | — | When true, the Save button shows a busy indicator and is non-pressable. |
| scrollEdgeBehavior | enum | — | iOS scroll-edge behavior. `"match"` collapses, `"transparent"` always transparent, `"opaque"` always opaque. |
| search | ScreenSearchOptions | — | Native search in the header (react-native-screens' `headerSearchBarOptions`): the system search field under the large title, which hides on scroll. On iOS 26 pass `placement: "integrated"` (or `"integratedButton"`) to put it in the toolbar; with a tab bar, search is usually its own tab (`role: "search"` on NativeTabs). Never draw your own. |
| testID | string | settings-sub-page | testID on the root container. Default `"settings-sub-page"`. |