@marktiderman/genesis-ui-native 3.11.0 → 3.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +69 -0
  2. package/dist/{chunk-ZUR4PK77.js → chunk-47CDRP43.js} +45 -166
  3. package/dist/chunk-47CDRP43.js.map +1 -0
  4. package/dist/{chunk-SG7LYX7Z.js → chunk-BQYT6TH2.js} +14 -6
  5. package/dist/chunk-BQYT6TH2.js.map +1 -0
  6. package/dist/{chunk-EAHK7D7N.js → chunk-C2ARUGT7.js} +146 -42
  7. package/dist/chunk-C2ARUGT7.js.map +1 -0
  8. package/dist/{chunk-VEWSY4TZ.js → chunk-D4UU6KIF.js} +236 -21
  9. package/dist/chunk-D4UU6KIF.js.map +1 -0
  10. package/dist/{chunk-GGH3ZQNO.js → chunk-TUDJDIGC.js} +4 -4
  11. package/dist/{chunk-GGH3ZQNO.js.map → chunk-TUDJDIGC.js.map} +1 -1
  12. package/dist/{chunk-PMS2V46D.js → chunk-VHUUOH46.js} +2 -2
  13. package/dist/{chunk-PMS2V46D.js.map → chunk-VHUUOH46.js.map} +1 -1
  14. package/dist/{chunk-IWWXERKQ.js → chunk-X5CPLUPZ.js} +1236 -136
  15. package/dist/chunk-X5CPLUPZ.js.map +1 -0
  16. package/dist/components/index.d.ts +510 -25
  17. package/dist/components/index.js +5 -5
  18. package/dist/data/index.d.ts +167 -33
  19. package/dist/data/index.js +1082 -760
  20. package/dist/data/index.js.map +1 -1
  21. package/dist/hooks/index.d.ts +2 -2
  22. package/dist/hooks/index.js +1 -1
  23. package/dist/icons/lucide.d.ts +1 -1
  24. package/dist/index.d.ts +6 -3
  25. package/dist/index.js +7 -7
  26. package/dist/layouts/index.d.ts +79 -6
  27. package/dist/layouts/index.js +5 -5
  28. package/dist/{native-modules-Bkm1jHO-.d.ts → native-modules-6JnyeGR-.d.ts} +55 -1
  29. package/package.json +70 -4
  30. package/src/components/__tests__/combobox.test.tsx +20 -0
  31. package/src/components/__tests__/number-input.test.tsx +112 -1
  32. package/src/components/__tests__/parity-controls.test.tsx +366 -0
  33. package/src/components/__tests__/parity-display.test.tsx +295 -0
  34. package/src/components/__tests__/twin-props.test.tsx +114 -0
  35. package/src/components/badge.tsx +3 -0
  36. package/src/components/button-group.tsx +50 -0
  37. package/src/components/calendar.tsx +183 -0
  38. package/src/components/carousel.tsx +175 -0
  39. package/src/components/chart.tsx +268 -0
  40. package/src/components/chip-group.tsx +34 -14
  41. package/src/components/choice-card.tsx +56 -19
  42. package/src/components/combobox.tsx +6 -5
  43. package/src/components/empty-state.tsx +40 -0
  44. package/src/components/flatten-children.ts +13 -0
  45. package/src/components/index.ts +49 -1
  46. package/src/components/inline-alert.tsx +3 -1
  47. package/src/components/input-group.tsx +99 -0
  48. package/src/components/input-otp.tsx +124 -0
  49. package/src/components/input.tsx +40 -12
  50. package/src/components/list-item.tsx +20 -4
  51. package/src/components/number-input.tsx +45 -15
  52. package/src/components/radio-group.tsx +5 -0
  53. package/src/components/resource.tsx +227 -0
  54. package/src/components/settings-row.tsx +194 -0
  55. package/src/components/slider.tsx +3 -9
  56. package/src/components/sortable-list.tsx +287 -0
  57. package/src/components/stat-card.tsx +106 -0
  58. package/src/components/stepper.tsx +4 -2
  59. package/src/components/widget-tile.tsx +66 -0
  60. package/src/components/workspace-switcher.tsx +217 -0
  61. package/src/data/NativeCustomView.tsx +117 -0
  62. package/src/data/NativeFormFields.tsx +312 -0
  63. package/src/data/NativeRecordPeek.tsx +130 -0
  64. package/src/data/NativeResourceFormField.tsx +32 -0
  65. package/src/data/__tests__/parity-data.test.tsx +350 -0
  66. package/src/data/index.ts +13 -0
  67. package/src/layouts/__tests__/keyboard-scroll.test.tsx +58 -2
  68. package/src/layouts/__tests__/notifications-page.test.tsx +12 -0
  69. package/src/layouts/index.ts +13 -0
  70. package/src/layouts/keyboard.tsx +22 -2
  71. package/src/layouts/notifications-page.tsx +13 -35
  72. package/src/layouts/pages.tsx +262 -0
  73. package/src/native-modules.tsx +37 -0
  74. package/dist/chunk-EAHK7D7N.js.map +0 -1
  75. package/dist/chunk-IWWXERKQ.js.map +0 -1
  76. package/dist/chunk-SG7LYX7Z.js.map +0 -1
  77. package/dist/chunk-VEWSY4TZ.js.map +0 -1
  78. package/dist/chunk-ZUR4PK77.js.map +0 -1
@@ -19,6 +19,10 @@
19
19
  * `SettingsSubPage`). It needs `component` too: the bar sits beside the
20
20
  * keyboard-aware scroll view. Without it, nothing changes.
21
21
  *
22
+ * `sticky` (optional, `KeyboardStickyView`) carries a layout's bottom bar (FormPage's Save /
23
+ * Cancel) up with the keyboard. Without it, with `component`, FormPage puts the bar at the end
24
+ * of the scrolling form instead, where the keyboard never covers it.
25
+ *
22
26
  * @stability Beta
23
27
  */
24
28
  import { createContext, createElement, useContext, useMemo, type ComponentType, type ReactNode } from "react";
@@ -59,9 +63,17 @@ export interface KeyboardToolbarProps {
59
63
  */
60
64
  export const KEYBOARD_TOOLBAR_HEIGHT = 42;
61
65
 
66
+ /** The props Genesis passes to a view that rides on the keyboard (`KeyboardStickyView`). */
67
+ export interface KeyboardStickyProps {
68
+ children?: ReactNode;
69
+ /** Extra distance from the keyboard, closed and open. */
70
+ offset?: { closed?: number; opened?: number };
71
+ }
72
+
62
73
  interface KeyboardScrollValue {
63
74
  component: ComponentType<KeyboardScrollProps>;
64
75
  toolbar: ComponentType<KeyboardToolbarProps> | null;
76
+ sticky: ComponentType<KeyboardStickyProps> | null;
65
77
  }
66
78
 
67
79
  const KeyboardScrollContext = createContext<KeyboardScrollValue | null>(null);
@@ -69,14 +81,17 @@ const KeyboardScrollContext = createContext<KeyboardScrollValue | null>(null);
69
81
  export function KeyboardScrollProvider({
70
82
  component,
71
83
  toolbar,
84
+ sticky,
72
85
  children,
73
86
  }: {
74
87
  component: ComponentType<KeyboardScrollProps>;
75
88
  /** `KeyboardToolbar` from react-native-keyboard-controller: previous / next / done above the keyboard. */
76
- toolbar?: ComponentType<KeyboardToolbarProps>;
89
+ toolbar?: ComponentType<KeyboardToolbarProps> | undefined;
90
+ /** `KeyboardStickyView` from react-native-keyboard-controller: keeps a form's action bar above the keyboard. */
91
+ sticky?: ComponentType<KeyboardStickyProps> | undefined;
77
92
  children: ReactNode;
78
93
  }) {
79
- const value = useMemo(() => ({ component, toolbar: toolbar ?? null }), [component, toolbar]);
94
+ const value = useMemo(() => ({ component, toolbar: toolbar ?? null, sticky: sticky ?? null }), [component, toolbar, sticky]);
80
95
  return createElement(KeyboardScrollContext.Provider, { value }, children);
81
96
  }
82
97
 
@@ -85,6 +100,11 @@ export function useKeyboardScroll(): ComponentType<KeyboardScrollProps> | null {
85
100
  return useContext(KeyboardScrollContext)?.component ?? null;
86
101
  }
87
102
 
103
+ /** The app's keyboard-riding view for a bottom bar, or null when none was provided (or no scroll view to go with it). */
104
+ export function useKeyboardSticky(): ComponentType<KeyboardStickyProps> | null {
105
+ return useContext(KeyboardScrollContext)?.sticky ?? null;
106
+ }
107
+
88
108
  /** The app's keyboard toolbar, or null when none was provided (or no scroll view to go with it). */
89
109
  export function useKeyboardToolbar(): ComponentType<KeyboardToolbarProps> | null {
90
110
  return useContext(KeyboardScrollContext)?.toolbar ?? null;
@@ -2,7 +2,7 @@
2
2
  * NotificationsPage — feed-style notifications list.
3
3
  *
4
4
  * Composes:
5
- * - SectionList grouped by relative date (Today / Yesterday / Earlier)
5
+ * - SectionList grouped by relative date (Upcoming / Today / Yesterday / Earlier)
6
6
  * - Pull-to-refresh
7
7
  * - Empty state slot (auto-rendered when `items` is empty)
8
8
  * - Mark-all-read action surfaced via `headerRight` helper
@@ -21,6 +21,7 @@
21
21
  * @stability Beta
22
22
  */
23
23
  import { useCallback, useContext, useMemo, type ReactNode } from "react";
24
+ import { groupNotificationsByDay, notificationDayBucket } from "@marktiderman/genesis-core/headless";
24
25
  import { renderSlot, type SlotPropsFor, type Slots } from "@marktiderman/genesis-core/slots";
25
26
  import {
26
27
  Platform,
@@ -71,6 +72,11 @@ export type NotificationsPageSlotMap = {
71
72
  export interface NotificationsPageProps extends ScreenHeaderProps {
72
73
  /** Notification items. Empty array → empty state. */
73
74
  items: NotificationItem[];
75
+ /**
76
+ * The zone whose days the headings count (an IANA name), as the web's NotificationsPage takes
77
+ * it. Default the device's, which is the person's own.
78
+ */
79
+ timeZone?: string;
74
80
  /** When true, the SectionList shows the refresh spinner. */
75
81
  refreshing?: boolean;
76
82
  /** Pull-to-refresh handler. */
@@ -154,45 +160,16 @@ export function getNotificationsPageStackOptions(props: {
154
160
  });
155
161
  }
156
162
 
157
- // Returns a stable section title for a timestamp. Computes against the
158
- // caller's local clock for consistency with the rest of the app.
159
- function bucketFor(ts: string | Date, now = new Date()): string {
160
- const d = typeof ts === "string" ? new Date(ts) : ts;
161
- const startOfDay = (date: Date) => {
162
- const x = new Date(date);
163
- x.setHours(0, 0, 0, 0);
164
- return x.getTime();
165
- };
166
- const today = startOfDay(now);
167
- const yesterday = today - 24 * 60 * 60 * 1000;
168
- const day = startOfDay(d);
169
- if (day === today) return "Today";
170
- if (day === yesterday) return "Yesterday";
171
- return "Earlier";
172
- }
163
+ // The day groups are genesis-core's, as the web's NotificationsPage draws them.
164
+ const bucketFor = (ts: string | Date, now: Date = new Date()) => notificationDayBucket(ts, { now });
173
165
 
174
166
  interface Section {
175
167
  title: string;
176
168
  data: NotificationItem[];
177
169
  }
178
170
 
179
- function groupByDate(items: NotificationItem[], now = new Date()): Section[] {
180
- const map = new Map<string, NotificationItem[]>();
181
- // Iterate in input order so stable sort within bucket.
182
- for (const item of items) {
183
- const bucket = bucketFor(item.timestamp, now);
184
- const arr = map.get(bucket) ?? [];
185
- arr.push(item);
186
- map.set(bucket, arr);
187
- }
188
- // Stable section order: Today / Yesterday / Earlier.
189
- const order = ["Today", "Yesterday", "Earlier"];
190
- return order
191
- .filter((title) => map.has(title))
192
- .map((title) => ({
193
- title,
194
- data: map.get(title) ?? [],
195
- }));
171
+ function groupByDate(items: NotificationItem[], now = new Date(), timeZone?: string): Section[] {
172
+ return groupNotificationsByDay(items, { now, timeZone });
196
173
  }
197
174
 
198
175
  type FlatRow = { kind: "header"; title: string } | { kind: "item"; item: NotificationItem; last: boolean };
@@ -242,6 +219,7 @@ export const __test = { bucketFor, groupByDate, flattenSections };
242
219
 
243
220
  export function NotificationsPage({
244
221
  items,
222
+ timeZone,
245
223
  refreshing,
246
224
  onRefresh,
247
225
  emptyState,
@@ -261,7 +239,7 @@ export function NotificationsPage({
261
239
  // ergonomics but consumed by getNotificationsPageStackOptions() at the
262
240
  // consumer's <Stack.Screen> level — not by this component.
263
241
 
264
- const sections = useMemo(() => groupByDate(items), [items]);
242
+ const sections = useMemo(() => groupByDate(items, new Date(), timeZone), [items, timeZone]);
265
243
  // FlashList v2 (`modules.list`) has no SectionList: the sections become one
266
244
  // flat list whose header rows stick (FlashList's own section-list recipe).
267
245
  const { list: FlashList } = useGenesisModules();
@@ -0,0 +1,262 @@
1
+ /**
2
+ * The phone's page layouts that match genesis-ui's: DashboardPage, DetailPage, DocumentPage and
3
+ * FormPage, with the same names and props (`title`, `subtitle`, `actions`, `stats`, `sidebar`,
4
+ * `cover`, `icon`, `errors`…). Each is a ScreenContainer (safe areas, theme background, pull to
5
+ * refresh, a loading state) with the page's title block and body, so a screen passes content and
6
+ * never draws the chrome.
7
+ *
8
+ * On a phone the stack header usually shows the screen's title too: pass `hideTitle` to leave
9
+ * the in-page title out, or give the stack the same title with `composeHeaderOptions`.
10
+ *
11
+ * @stability Beta
12
+ */
13
+ import type { ReactNode } from "react";
14
+ import { Keyboard, KeyboardAvoidingView, Platform, ScrollView, Text, View } from "react-native";
15
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
16
+ import { flattenChildren } from "../components/flatten-children";
17
+ import { NativeImage } from "../components/image";
18
+ import { NativeInlineAlert } from "../components/inline-alert";
19
+ import { cn } from "../utils";
20
+ import { KEYBOARD_TOOLBAR_HEIGHT, useKeyboardScroll, useKeyboardSticky, useKeyboardToolbar } from "./keyboard";
21
+ import { ScreenContainer, type ScreenContainerProps } from "./screen-container";
22
+
23
+ type ContainerProps = Pick<ScreenContainerProps, "onRefresh" | "refreshing" | "loading" | "loadingLabel" | "safeAreaEdges" | "className" | "contentClassName">;
24
+
25
+ interface PageTitleProps {
26
+ title: ReactNode;
27
+ subtitle?: ReactNode;
28
+ actions?: ReactNode;
29
+ /** Leave the in-page title out (the stack header shows it). */
30
+ hideTitle?: boolean;
31
+ testID?: string;
32
+ }
33
+
34
+ const text = (node: ReactNode, className: string, header = false) =>
35
+ typeof node === "string" || typeof node === "number" ? (
36
+ <Text className={className} accessibilityRole={header ? "header" : undefined}>
37
+ {node}
38
+ </Text>
39
+ ) : (
40
+ node
41
+ );
42
+
43
+ /** The title block every page shares: a title, a line under it, and the page's actions. */
44
+ function PageTitle({ title, subtitle, actions, hideTitle, testID, size = "page", above }: PageTitleProps & { size?: "page" | "document"; above?: ReactNode }) {
45
+ if (hideTitle && !actions && !above) return null;
46
+ return (
47
+ <View testID={`${testID}-header`} className="gap-2">
48
+ {above}
49
+ {hideTitle ? null : (
50
+ <View className="gap-1">
51
+ {text(title, size === "document" ? "text-3xl font-bold text-foreground" : "text-2xl font-bold text-foreground", true)}
52
+ {subtitle ? text(subtitle, "text-sm text-muted-foreground") : null}
53
+ </View>
54
+ )}
55
+ {actions ? <View className="flex-row flex-wrap items-center gap-2">{actions}</View> : null}
56
+ </View>
57
+ );
58
+ }
59
+
60
+ export interface DashboardPageProps extends PageTitleProps, ContainerProps {
61
+ /** Stat tiles (NativeStatCard), two to a row. */
62
+ stats?: ReactNode;
63
+ /** Tiles per row. Default 2. */
64
+ statColumns?: 1 | 2 | 3;
65
+ children?: ReactNode;
66
+ }
67
+
68
+ export function DashboardPage({ title, subtitle, actions, hideTitle, stats, statColumns = 2, children, testID = "dashboard-page", ...container }: DashboardPageProps) {
69
+ const tiles = flattenChildren(stats);
70
+ const basis = statColumns === 1 ? "w-full" : statColumns === 3 ? "min-w-[30%]" : "min-w-[45%]";
71
+ return (
72
+ <ScreenContainer {...container} scroll testID={testID} contentClassName={cn("gap-6 p-4", container.contentClassName)}>
73
+ <PageTitle title={title} subtitle={subtitle} actions={actions} hideTitle={hideTitle} testID={testID} />
74
+ {tiles.length ? (
75
+ <View testID={`${testID}-stats`} className="flex-row flex-wrap gap-3">
76
+ {tiles.map((tile, i) => (
77
+ <View key={i} className={cn("flex-1", basis)}>
78
+ {tile}
79
+ </View>
80
+ ))}
81
+ </View>
82
+ ) : null}
83
+ <View testID={`${testID}-body`} className="gap-8">
84
+ {children}
85
+ </View>
86
+ </ScreenContainer>
87
+ );
88
+ }
89
+
90
+ export interface DetailPageProps extends PageTitleProps, ContainerProps {
91
+ /** Above the title (a parent's name). */
92
+ breadcrumb?: ReactNode;
93
+ /** The web's side column; on a phone it follows the content. */
94
+ sidebar?: ReactNode;
95
+ children?: ReactNode;
96
+ }
97
+
98
+ export function DetailPage({ title, subtitle, actions, hideTitle, breadcrumb, sidebar, children, testID = "detail-page", ...container }: DetailPageProps) {
99
+ return (
100
+ <ScreenContainer {...container} scroll testID={testID} contentClassName={cn("gap-6 p-4", container.contentClassName)}>
101
+ <PageTitle
102
+ title={title}
103
+ subtitle={subtitle}
104
+ actions={actions}
105
+ hideTitle={hideTitle}
106
+ testID={testID}
107
+ above={breadcrumb ? text(breadcrumb, "text-sm text-muted-foreground") : undefined}
108
+ />
109
+ <View testID={`${testID}-content`}>{children}</View>
110
+ {sidebar ? (
111
+ <View testID={`${testID}-sidebar`} className="gap-4 border-t border-border pt-4">
112
+ {sidebar}
113
+ </View>
114
+ ) : null}
115
+ </ScreenContainer>
116
+ );
117
+ }
118
+
119
+ export interface DocumentPageProps extends PageTitleProps, ContainerProps {
120
+ /** An emoji, an image or an icon over the title. */
121
+ icon?: ReactNode;
122
+ /** A banner across the top: an image URL, or your own node. */
123
+ cover?: string | ReactNode;
124
+ /** `reading` (default) keeps a reading column on a tablet; `full` uses the width. */
125
+ width?: "reading" | "full";
126
+ children?: ReactNode;
127
+ }
128
+
129
+ export function DocumentPage({ title, subtitle, actions, hideTitle, icon, cover, width = "reading", children, testID = "document-page", ...container }: DocumentPageProps) {
130
+ const hasCover = cover != null && cover !== false;
131
+ return (
132
+ <ScreenContainer {...container} scroll testID={testID} contentClassName={cn("pb-8", container.contentClassName)}>
133
+ {hasCover ? (
134
+ <View testID={`${testID}-cover`} className="h-40 w-full overflow-hidden bg-muted">
135
+ {typeof cover === "string" ? <NativeImage src={cover} className="h-full w-full" /> : cover}
136
+ </View>
137
+ ) : null}
138
+ <View className={cn("w-full gap-6 px-4", width === "reading" && "max-w-[680px] self-center", hasCover ? "pt-0" : "pt-4")}>
139
+ <PageTitle
140
+ title={title}
141
+ subtitle={subtitle}
142
+ actions={actions}
143
+ hideTitle={hideTitle}
144
+ testID={testID}
145
+ size="document"
146
+ above={
147
+ icon != null ? (
148
+ <View testID={`${testID}-icon`} className={cn("h-16 w-16 items-center justify-center", hasCover && "-mt-8")} accessibilityElementsHidden={typeof icon === "string"}>
149
+ {typeof icon === "string" ? <Text className="text-5xl">{icon}</Text> : icon}
150
+ </View>
151
+ ) : undefined
152
+ }
153
+ />
154
+ <View testID={`${testID}-body`}>{children}</View>
155
+ </View>
156
+ </ScreenContainer>
157
+ );
158
+ }
159
+
160
+ export interface FormPageProps extends ContainerProps {
161
+ title: ReactNode;
162
+ description?: ReactNode;
163
+ /** A summary of what to fix, over the fields. */
164
+ errors?: ReactNode;
165
+ /**
166
+ * The Save / Cancel row. It stays above the keyboard: through the app's keyboard-aware scroll
167
+ * view and `KeyboardStickyView` when it gave them (`KeyboardScrollProvider`), else in a
168
+ * KeyboardAvoidingView. With a keyboard-aware scroll view but no sticky view, it ends the form.
169
+ * A touch on it dismisses the keyboard first, so the focused field commits what's typed before
170
+ * the button's press runs.
171
+ */
172
+ actions?: ReactNode;
173
+ hideTitle?: boolean;
174
+ children?: ReactNode;
175
+ testID?: string;
176
+ }
177
+
178
+ const dismissKeyboard = () => {
179
+ Keyboard.dismiss();
180
+ return false;
181
+ };
182
+
183
+ /** FormPage's action bar: a row of buttons with its padding, kept clear of the focused field. */
184
+ const FORM_ACTIONS_HEIGHT = 64;
185
+
186
+ export function FormPage({ title, description, errors, actions, hideTitle, children, testID = "form-page", onRefresh: _onRefresh, refreshing: _refreshing, ...container }: FormPageProps) {
187
+ // The package's keyboard handling, as AuthScreen and SettingsSubPage use it.
188
+ const KeyboardScroll = useKeyboardScroll();
189
+ const KeyboardToolbar = useKeyboardToolbar();
190
+ const Sticky = useKeyboardSticky();
191
+ const insets = useSafeAreaInsets();
192
+ // The padding is the form's own: ScreenContainer's body gets none, so it isn't doubled.
193
+ const { contentClassName, ...outer } = container;
194
+ const form = (
195
+ <>
196
+ <PageTitle title={title} subtitle={description} hideTitle={hideTitle} testID={testID} />
197
+ {errors ? (
198
+ <NativeInlineAlert variant="destructive" testID={`${testID}-errors`}>
199
+ {text(errors, "text-sm text-foreground")}
200
+ </NativeInlineAlert>
201
+ ) : null}
202
+ <View testID={`${testID}-fields`} className="gap-6">
203
+ {children}
204
+ </View>
205
+ </>
206
+ );
207
+ const bar = (inFlow: boolean) =>
208
+ actions ? (
209
+ <View
210
+ testID={`${testID}-actions`}
211
+ // A touch on Save or Cancel first dismisses the keyboard, so the focused field ends its edit
212
+ // (a NativeNumberInput commits what's typed) before the press runs. The scroll keeps taps
213
+ // ("handled"), which otherwise leaves the field focused. Returning false lets the button
214
+ // take the touch.
215
+ onStartShouldSetResponderCapture={dismissKeyboard}
216
+ className={cn("flex-row flex-wrap items-center justify-end gap-2", !inFlow && "border-t border-border bg-background px-4 py-3")}
217
+ >
218
+ {actions}
219
+ </View>
220
+ ) : null;
221
+
222
+ if (KeyboardScroll) {
223
+ const toolbar = KeyboardToolbar ? KEYBOARD_TOOLBAR_HEIGHT : 0;
224
+ const sticky = Boolean(Sticky && actions);
225
+ return (
226
+ <ScreenContainer testID={testID} {...outer}>
227
+ <KeyboardScroll
228
+ testID={`${testID}-scroll`}
229
+ keyboardShouldPersistTaps="handled"
230
+ contentInsetAdjustmentBehavior="automatic"
231
+ bottomOffset={24 + toolbar + (sticky ? FORM_ACTIONS_HEIGHT : 0)}
232
+ >
233
+ <View className={cn("gap-6 p-4", contentClassName)}>
234
+ {form}
235
+ {sticky ? null : bar(true)}
236
+ </View>
237
+ </KeyboardScroll>
238
+ {sticky && Sticky ? (
239
+ // Open, the bar meets the keyboard (or its toolbar) rather than floating the home indicator's height above it.
240
+ <Sticky offset={{ closed: 0, opened: insets.bottom - toolbar }}>{bar(false)}</Sticky>
241
+ ) : null}
242
+ {KeyboardToolbar ? <KeyboardToolbar /> : null}
243
+ </ScreenContainer>
244
+ );
245
+ }
246
+ return (
247
+ <KeyboardAvoidingView testID={`${testID}-kav`} style={{ flex: 1 }} behavior={Platform.OS === "ios" ? "padding" : undefined}>
248
+ <ScreenContainer testID={testID} {...outer}>
249
+ <ScrollView
250
+ testID={`${testID}-scroll`}
251
+ className="flex-1"
252
+ contentContainerClassName={cn("gap-6 p-4", contentClassName)}
253
+ keyboardShouldPersistTaps="handled"
254
+ contentInsetAdjustmentBehavior="automatic"
255
+ >
256
+ {form}
257
+ </ScrollView>
258
+ {bar(false)}
259
+ </ScreenContainer>
260
+ </KeyboardAvoidingView>
261
+ );
262
+ }
@@ -200,6 +200,43 @@ export interface GenesisModules {
200
200
  haptics?: GenesisHapticsModule;
201
201
  /** react-native-gesture-handler's `ReanimatedSwipeable`: NativeSwipeRow and InboxPage's rows. Without it, no swipe; the actions stay on long press. */
202
202
  swipeable?: GenesisSwipeableComponent;
203
+ /**
204
+ * react-native-svg (`import * as Svg from "react-native-svg"`): NativeChartContainer draws line
205
+ * and area charts with it. Without it, bars still draw (they're views) and a line chart shows its
206
+ * points only.
207
+ */
208
+ svg?: GenesisSvgModule;
209
+ /**
210
+ * Picks files for NativeFileUploadField (and a form's file and image fields): wrap
211
+ * expo-document-picker's `getDocumentAsync` or expo-image-picker's `launchImageLibraryAsync`
212
+ * and return the picked files, or `[]` when the person cancelled.
213
+ */
214
+ filePicker?: GenesisFilePicker;
215
+ }
216
+
217
+ /** A file a person picked on the phone: where it is, its name, and its type and size when known. */
218
+ export interface NativePickedFile {
219
+ uri: string;
220
+ name: string;
221
+ /** MIME type, e.g. "image/jpeg". */
222
+ type?: string | undefined;
223
+ /** Bytes. */
224
+ size?: number | undefined;
225
+ }
226
+
227
+ /**
228
+ * Opens the system's picker; resolves to what was picked, `[]` when the person cancelled. Reject
229
+ * when it can't pick (a permission denied, an iCloud download that failed): the field shows its
230
+ * `labels.pickFailed` sentence, never the raw error. If your app explains a denial itself (with a
231
+ * link to Settings, say), do that and resolve `[]`.
232
+ */
233
+ export type GenesisFilePicker = (options: { multiple: boolean; accept?: string | undefined }) => Promise<NativePickedFile[]>;
234
+
235
+ /** The react-native-svg parts NativeChartContainer draws with. */
236
+ export interface GenesisSvgModule {
237
+ default?: ComponentType<{ width?: number; height?: number; children?: ReactNode; testID?: string }>;
238
+ Svg?: ComponentType<{ width?: number; height?: number; children?: ReactNode; testID?: string }>;
239
+ Path: ComponentType<{ d: string; stroke?: ColorValue; strokeWidth?: number; fill?: ColorValue; fillOpacity?: number; testID?: string }>;
203
240
  }
204
241
 
205
242
  /** The props NativeSwipeRow passes; `ReanimatedSwipeable` takes them, and its ref has `close()`. */