@marktiderman/genesis-ui-native 3.5.1 → 3.7.0
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.
- package/README.md +115 -7
- package/dist/{chunk-ONH2PCGH.js → chunk-3KFUS7O6.js} +9 -15
- package/dist/chunk-3KFUS7O6.js.map +1 -0
- package/dist/{chunk-LBVD7XXL.js → chunk-7NDKIIOT.js} +627 -20
- package/dist/chunk-7NDKIIOT.js.map +1 -0
- package/dist/chunk-CAI7LGN6.js +39 -0
- package/dist/chunk-CAI7LGN6.js.map +1 -0
- package/dist/{chunk-ABVSSJNT.js → chunk-GBNIBHSU.js} +198 -168
- package/dist/chunk-GBNIBHSU.js.map +1 -0
- package/dist/chunk-IXC3LO2K.js +410 -0
- package/dist/chunk-IXC3LO2K.js.map +1 -0
- package/dist/{chunk-GHYUNNNU.js → chunk-KH2RVAI5.js} +174 -93
- package/dist/chunk-KH2RVAI5.js.map +1 -0
- package/dist/{chunk-6KWEAGRD.js → chunk-O4BMDV7I.js} +110 -17
- package/dist/chunk-O4BMDV7I.js.map +1 -0
- package/dist/chunk-RTYO24SC.js +105 -0
- package/dist/chunk-RTYO24SC.js.map +1 -0
- package/dist/{chunk-D5RKSPMH.js → chunk-YWDDDYDI.js} +4 -3
- package/dist/chunk-YWDDDYDI.js.map +1 -0
- package/dist/components/index.d.ts +382 -10
- package/dist/components/index.js +6 -5
- package/dist/data/index.d.ts +68 -4
- package/dist/data/index.js +231 -30
- package/dist/data/index.js.map +1 -1
- package/dist/hooks/index.d.ts +90 -2
- package/dist/hooks/index.js +3 -3
- package/dist/icons/lucide.d.ts +1 -1
- package/dist/icons/lucide.js +7 -1
- package/dist/icons/lucide.js.map +1 -1
- package/dist/{inbox-page-BEarNEIP.d.ts → inbox-page-B7_Oi2fS.d.ts} +2 -44
- package/dist/index.d.ts +8 -5
- package/dist/index.js +9 -8
- package/dist/layouts/index.d.ts +40 -51
- package/dist/layouts/index.js +6 -4
- package/dist/{native-modules-PwnGltOU.d.ts → native-modules-DEJJQhDx.d.ts} +55 -1
- package/package.json +101 -4
- package/src/__tests__/doctor-rules.test.ts +87 -0
- package/src/__tests__/native-modules-lists.test.tsx +1 -0
- package/src/components/__tests__/button-haptic.test.tsx +52 -0
- package/src/components/__tests__/composer-bar.test.tsx +79 -0
- package/src/components/__tests__/gallery-card.test.tsx +59 -0
- package/src/components/__tests__/gallery-grid.test.tsx +160 -0
- package/src/components/__tests__/lightbox-resnap.test.tsx +50 -0
- package/src/components/__tests__/lightbox-zoom.test.ts +33 -0
- package/src/components/__tests__/lightbox.test.tsx +141 -0
- package/src/components/__tests__/live-indicator.test.tsx +72 -0
- package/src/components/__tests__/rating.test.tsx +82 -0
- package/src/components/__tests__/thread-list.test.tsx +219 -0
- package/src/components/button.tsx +18 -1
- package/src/components/composer-bar.tsx +276 -0
- package/src/components/drawer.tsx +15 -9
- package/src/components/gallery-card.tsx +109 -0
- package/src/components/gallery-grid.tsx +285 -0
- package/src/components/gallery-layout.ts +2 -0
- package/src/components/gallery-types.ts +2 -0
- package/src/components/index.ts +44 -0
- package/src/components/lightbox-zoom.tsx +282 -0
- package/src/components/lightbox.tsx +342 -0
- package/src/components/live-indicator.tsx +139 -0
- package/src/components/rating.tsx +128 -0
- package/src/components/skeleton.tsx +9 -4
- package/src/components/thread-list.tsx +457 -0
- package/src/components/toast.tsx +7 -4
- package/src/data/NativeConflictSheet.tsx +181 -0
- package/src/data/NativeResourceForm.tsx +15 -1
- package/src/data/index.ts +2 -0
- package/src/data/resource-view/NativeRecordView.tsx +85 -8
- package/src/data/resource-view/NativeResourceView.tsx +79 -32
- package/src/data/resource-view/__tests__/native-record-view.test.tsx +95 -1
- package/src/data/resource-view/__tests__/native-resource-gallery.test.tsx +125 -0
- package/src/hooks/__tests__/use-haptics.test.tsx +146 -0
- package/src/hooks/__tests__/use-motion.test.tsx +106 -0
- package/src/hooks/__tests__/use-thread-jump.test.tsx +88 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/use-haptics.ts +64 -0
- package/src/hooks/use-motion.ts +128 -0
- package/src/hooks/use-press-feedback.ts +87 -0
- package/src/hooks/use-thread-jump.ts +110 -0
- package/src/icon-names.ts +6 -0
- package/src/icons/lucide.ts +12 -0
- package/src/layouts/__tests__/inbox-page.test.tsx +6 -0
- package/src/layouts/__tests__/thread-page.test.tsx +114 -14
- package/src/layouts/inbox-page.tsx +6 -55
- package/src/layouts/index.ts +2 -0
- package/src/layouts/thread-page.tsx +326 -262
- package/src/native-modules.tsx +20 -2
- package/dist/chunk-6KWEAGRD.js.map +0 -1
- package/dist/chunk-7PCWEY6R.js +0 -27
- package/dist/chunk-7PCWEY6R.js.map +0 -1
- package/dist/chunk-ABVSSJNT.js.map +0 -1
- package/dist/chunk-D5RKSPMH.js.map +0 -1
- package/dist/chunk-GHYUNNNU.js.map +0 -1
- package/dist/chunk-LBVD7XXL.js.map +0 -1
- package/dist/chunk-ONH2PCGH.js.map +0 -1
- package/dist/chunk-Z3AQYVUA.js +0 -36
- package/dist/chunk-Z3AQYVUA.js.map +0 -1
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NativeThreadList — a conversation's list: oldest first, top to bottom (the
|
|
3
|
+
* order VoiceOver reads), that opens at the newest row, follows new rows only
|
|
4
|
+
* while you're at the bottom, keeps your place while earlier rows load at the
|
|
5
|
+
* top, and can go to one row (a search result, the first unread).
|
|
6
|
+
*
|
|
7
|
+
* The atom under ThreadPage, and the one any app builds its own thread from:
|
|
8
|
+
* it renders the rows it's given and never fetches. Earlier pages come from
|
|
9
|
+
* `onLoadEarlier`, a row out of reach from `onLoadUntil(id)`.
|
|
10
|
+
*
|
|
11
|
+
* FlashList v2 (`GenesisModules.list`) when the app passed it: its chat mode
|
|
12
|
+
* (`startRenderingFromBottom`, `autoscrollToBottomThreshold`, the first
|
|
13
|
+
* visible row held when rows prepend). Without it, FlatList, which keeps its
|
|
14
|
+
* place with `maintainVisibleContentPosition` (anchored past the header) and
|
|
15
|
+
* follows the bottom by hand.
|
|
16
|
+
*
|
|
17
|
+
* Not inverted: in an inverted FlashList a new row at index 0 lands under the
|
|
18
|
+
* composer, and VoiceOver reads each day's heading after its messages.
|
|
19
|
+
*
|
|
20
|
+
* Earlier rows load by themselves near the top, and the explicit "Load
|
|
21
|
+
* earlier" button stays: VoiceOver can't reach rows a virtualized list hasn't
|
|
22
|
+
* rendered. Going to a row waits for `loading`, loads until it's held,
|
|
23
|
+
* scrolls to it (again after FlashList's own placement on open), highlights
|
|
24
|
+
* it for two seconds and announces it. Reduce Motion scrolls without
|
|
25
|
+
* animating.
|
|
26
|
+
*
|
|
27
|
+
* Promoted from genesis-chat's thread and its `useJumpToMessage` (G4); chat
|
|
28
|
+
* moves onto it later.
|
|
29
|
+
*
|
|
30
|
+
* @stability Beta
|
|
31
|
+
*/
|
|
32
|
+
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState, type ComponentType, type ReactElement, type ReactNode } from "react";
|
|
33
|
+
import { AccessibilityInfo, FlatList, Platform, Pressable, View } from "react-native";
|
|
34
|
+
import { useGenesisModules } from "../native-modules";
|
|
35
|
+
import { useReducedMotion } from "../hooks/use-reduced-motion";
|
|
36
|
+
import { useThemeRoles } from "../hooks/use-theme-roles";
|
|
37
|
+
import { useThreadJump } from "@marktiderman/genesis-core/conversation";
|
|
38
|
+
import { NativeSkeleton } from "./skeleton";
|
|
39
|
+
import { NativeText } from "./text";
|
|
40
|
+
|
|
41
|
+
/** The scroll event fields the list reads. */
|
|
42
|
+
interface ScrollMetrics {
|
|
43
|
+
contentOffset: { y: number };
|
|
44
|
+
contentSize: { height: number };
|
|
45
|
+
layoutMeasurement: { height: number };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const announce = (text: string) => (AccessibilityInfo as { announceForAccessibility?: (t: string) => void }).announceForAccessibility?.(text);
|
|
49
|
+
|
|
50
|
+
/** Points from the bottom that still count as "at the bottom". */
|
|
51
|
+
export const THREAD_AT_BOTTOM_POINTS = 120;
|
|
52
|
+
|
|
53
|
+
/** After the list scrolls itself (to the newest, to a row), how long its own scroll events don't count. */
|
|
54
|
+
const SETTLING_MS = 400;
|
|
55
|
+
|
|
56
|
+
/** Whether a scroll position is at (or near) the bottom of its content. */
|
|
57
|
+
export function threadNearBottom(m: ScrollMetrics, slack = THREAD_AT_BOTTOM_POINTS): boolean {
|
|
58
|
+
return m.contentOffset.y + m.layoutMeasurement.height >= m.contentSize.height - slack;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* How the list is set up. FlashList follows by itself, within
|
|
63
|
+
* `THREAD_AT_BOTTOM_POINTS` of the bottom (its threshold is a fraction of the
|
|
64
|
+
* viewport: a fifth until the viewport's height is known); FlatList keeps its
|
|
65
|
+
* place on prepend, anchored on the first row past the header (index 1: the
|
|
66
|
+
* header is child 0), and the list follows the bottom by hand.
|
|
67
|
+
*/
|
|
68
|
+
export function threadListMode(
|
|
69
|
+
flash: boolean,
|
|
70
|
+
reducedMotion: boolean,
|
|
71
|
+
viewportHeight = 0,
|
|
72
|
+
): { followsByHand: boolean; maintainVisibleContentPosition: Record<string, unknown> } {
|
|
73
|
+
if (flash) {
|
|
74
|
+
const threshold = viewportHeight > 0 ? Math.min(1, THREAD_AT_BOTTOM_POINTS / viewportHeight) : 0.2;
|
|
75
|
+
return {
|
|
76
|
+
followsByHand: false,
|
|
77
|
+
maintainVisibleContentPosition: { startRenderingFromBottom: true, autoscrollToBottomThreshold: threshold, animateAutoScrollToBottom: !reducedMotion },
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return { followsByHand: true, maintainVisibleContentPosition: { minIndexForVisible: 1 } };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface NativeThreadListHandle {
|
|
84
|
+
/** Go to the newest row (after a send: what you send is what you look at next). */
|
|
85
|
+
scrollToEnd: (options?: { animated?: boolean }) => void;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** What `renderItem` is told about a row besides the row itself. */
|
|
89
|
+
export interface ThreadRowInfo {
|
|
90
|
+
index: number;
|
|
91
|
+
/** The row a jump just landed on, for two seconds. */
|
|
92
|
+
highlighted: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface NativeThreadListProps<T> {
|
|
96
|
+
/** Oldest first. */
|
|
97
|
+
data: readonly T[];
|
|
98
|
+
/** A row's id. It must stay the same across refreshes (from a cache to the server), or rows jump. */
|
|
99
|
+
keyExtractor: (row: T) => string;
|
|
100
|
+
renderItem: (row: T, info: ThreadRowInfo) => ReactElement | null;
|
|
101
|
+
/** Rows of different shapes recycle apart (FlashList): "mine", "theirs", "event". */
|
|
102
|
+
getItemType?: (row: T) => string;
|
|
103
|
+
/** The first page is loading: shows `loadingView` (a skeleton by default), and a jump waits. */
|
|
104
|
+
loading?: boolean;
|
|
105
|
+
loadingView?: ReactNode;
|
|
106
|
+
/** There are earlier rows: loads them near the top, and shows the "Load earlier" button. */
|
|
107
|
+
hasEarlier?: boolean;
|
|
108
|
+
onLoadEarlier?: () => void;
|
|
109
|
+
loadingEarlier?: boolean;
|
|
110
|
+
earlierLabel?: string;
|
|
111
|
+
/** Replaces the default "Load earlier" button. */
|
|
112
|
+
renderEarlier?: (props: { loading: boolean; onPress: () => void; label: string; testID: string }) => ReactNode;
|
|
113
|
+
/** Go to this row, loading earlier pages with `onLoadUntil` until it's here. A new id, or the same one after `null`, goes again. */
|
|
114
|
+
jumpTo?: string | null;
|
|
115
|
+
/**
|
|
116
|
+
* The id `jumpTo` names a row by, when it isn't the row's key: a message keyed by the id the
|
|
117
|
+
* phone gave it (so it keeps its row when the server's copy lands) and gone to by the server's
|
|
118
|
+
* id. `null` for a row that can't be gone to (a day heading). `keyExtractor` by default.
|
|
119
|
+
* Pass a stable function (module scope, or `useCallback`): a new one each render re-renders every row.
|
|
120
|
+
*/
|
|
121
|
+
jumpId?: (row: T) => string | null | undefined;
|
|
122
|
+
/** Load earlier pages until the row is held; resolve false when it can't be found. */
|
|
123
|
+
onLoadUntil?: (id: string) => Promise<boolean>;
|
|
124
|
+
/** What VoiceOver says on arriving at `jumpTo`. */
|
|
125
|
+
jumpAnnouncement?: (row: T) => string;
|
|
126
|
+
/** The row couldn't be found (deleted, out of reach). The list goes back to the newest row first. */
|
|
127
|
+
onJumpFailed?: (id: string) => void;
|
|
128
|
+
/** Whether the reader is at the bottom, as it changes (to show a "new messages" pill, say). */
|
|
129
|
+
onAtBottomChange?: (atBottom: boolean) => void;
|
|
130
|
+
/** Above the first row, before the "Load earlier" button: what the thread is about. */
|
|
131
|
+
header?: ReactNode;
|
|
132
|
+
/** Under the last row: who is typing, a "Sending…" line. */
|
|
133
|
+
footer?: ReactNode;
|
|
134
|
+
/** Shown instead of the rows when there are none. */
|
|
135
|
+
empty?: ReactNode;
|
|
136
|
+
testID?: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** The FlatList and FlashList v2 props the thread passes. */
|
|
140
|
+
interface ThreadListComponentProps {
|
|
141
|
+
ref?: unknown;
|
|
142
|
+
data: readonly unknown[];
|
|
143
|
+
renderItem: (info: { item: unknown; index: number }) => ReactElement | null;
|
|
144
|
+
keyExtractor: (row: unknown) => string;
|
|
145
|
+
getItemType?: (row: unknown) => string;
|
|
146
|
+
extraData?: unknown;
|
|
147
|
+
onStartReached?: () => void;
|
|
148
|
+
onStartReachedThreshold?: number;
|
|
149
|
+
ListHeaderComponent?: ReactElement | null;
|
|
150
|
+
ListFooterComponent?: ReactElement | null;
|
|
151
|
+
keyboardShouldPersistTaps?: "handled";
|
|
152
|
+
keyboardDismissMode?: "interactive" | "on-drag";
|
|
153
|
+
contentInsetAdjustmentBehavior?: "automatic";
|
|
154
|
+
contentContainerStyle?: Record<string, unknown>;
|
|
155
|
+
maintainVisibleContentPosition?: Record<string, unknown>;
|
|
156
|
+
onScroll?: (e: { nativeEvent: ScrollMetrics }) => void;
|
|
157
|
+
onScrollBeginDrag?: () => void;
|
|
158
|
+
scrollEventThrottle?: number;
|
|
159
|
+
onContentSizeChange?: () => void;
|
|
160
|
+
onLayout?: () => void;
|
|
161
|
+
onScrollToIndexFailed?: (info: { index: number; averageItemLength: number }) => void;
|
|
162
|
+
accessibilityRole?: "list";
|
|
163
|
+
testID?: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
interface ListRef {
|
|
167
|
+
scrollToEnd?: (o?: { animated?: boolean }) => void;
|
|
168
|
+
scrollToIndex?: (o: { index: number; animated?: boolean; viewPosition?: number }) => void;
|
|
169
|
+
scrollToOffset?: (o: { offset: number; animated?: boolean }) => void;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function NativeThreadListInner<T>(props: NativeThreadListProps<T>, ref: React.ForwardedRef<NativeThreadListHandle>) {
|
|
173
|
+
const {
|
|
174
|
+
data,
|
|
175
|
+
keyExtractor,
|
|
176
|
+
renderItem,
|
|
177
|
+
getItemType,
|
|
178
|
+
loading = false,
|
|
179
|
+
loadingView,
|
|
180
|
+
hasEarlier = false,
|
|
181
|
+
onLoadEarlier,
|
|
182
|
+
loadingEarlier = false,
|
|
183
|
+
earlierLabel = "Load earlier messages",
|
|
184
|
+
renderEarlier,
|
|
185
|
+
jumpTo,
|
|
186
|
+
jumpId,
|
|
187
|
+
onLoadUntil,
|
|
188
|
+
jumpAnnouncement,
|
|
189
|
+
onJumpFailed,
|
|
190
|
+
onAtBottomChange,
|
|
191
|
+
footer,
|
|
192
|
+
header,
|
|
193
|
+
empty,
|
|
194
|
+
testID = "thread-list",
|
|
195
|
+
} = props;
|
|
196
|
+
const genesis = useGenesisModules();
|
|
197
|
+
const reducedMotion = useReducedMotion();
|
|
198
|
+
const List = (genesis.list ?? FlatList) as unknown as ComponentType<ThreadListComponentProps>;
|
|
199
|
+
const [viewport, setViewport] = useState(0);
|
|
200
|
+
const mode = threadListMode(Boolean(genesis.list), reducedMotion, viewport);
|
|
201
|
+
// The last position the list reported, to re-check "at the bottom" after it moves itself.
|
|
202
|
+
const metrics = useRef<ScrollMetrics | null>(null);
|
|
203
|
+
const recheck = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
204
|
+
useEffect(() => () => {
|
|
205
|
+
if (recheck.current) clearTimeout(recheck.current);
|
|
206
|
+
}, []);
|
|
207
|
+
const listRef = useRef<ListRef | null>(null);
|
|
208
|
+
// At the bottom (or not yet scrolled): new rows and a shorter list keep it there.
|
|
209
|
+
const atBottom = useRef(true);
|
|
210
|
+
// FlatList opens at the top and is moved down a frame later: until then the top isn't "reached".
|
|
211
|
+
const placed = useRef(!mode.followsByHand);
|
|
212
|
+
// While the list scrolls itself, its own scroll events don't move "at the bottom".
|
|
213
|
+
const settlingUntil = useRef(0);
|
|
214
|
+
const timers = useRef(new Set<ReturnType<typeof setTimeout>>());
|
|
215
|
+
const later = useCallback((fn: () => void, ms: number) => {
|
|
216
|
+
const t = setTimeout(() => {
|
|
217
|
+
timers.current.delete(t);
|
|
218
|
+
fn();
|
|
219
|
+
}, ms);
|
|
220
|
+
timers.current.add(t);
|
|
221
|
+
}, []);
|
|
222
|
+
useEffect(() => {
|
|
223
|
+
const pending = timers.current;
|
|
224
|
+
return () => pending.forEach(clearTimeout);
|
|
225
|
+
}, []);
|
|
226
|
+
const idOf = jumpId ?? keyExtractor;
|
|
227
|
+
const latest = useRef({ data, idOf, jumpAnnouncement, onJumpFailed, onAtBottomChange });
|
|
228
|
+
latest.current = { data, idOf, jumpAnnouncement, onJumpFailed, onAtBottomChange };
|
|
229
|
+
// The row a jump names, by `jumpId` (the key by default).
|
|
230
|
+
const indexOf = useCallback((id: string) => latest.current.data.findIndex((row) => latest.current.idOf(row) === id), []);
|
|
231
|
+
|
|
232
|
+
const setAtBottom = useCallback((v: boolean) => {
|
|
233
|
+
if (atBottom.current === v) return;
|
|
234
|
+
atBottom.current = v;
|
|
235
|
+
latest.current.onAtBottomChange?.(v);
|
|
236
|
+
}, []);
|
|
237
|
+
|
|
238
|
+
const toBottom = useCallback(
|
|
239
|
+
(animated: boolean) => {
|
|
240
|
+
settlingUntil.current = Date.now() + SETTLING_MS;
|
|
241
|
+
const go = (a: boolean) => listRef.current?.scrollToEnd?.({ animated: a && !reducedMotion });
|
|
242
|
+
requestAnimationFrame(() => {
|
|
243
|
+
go(animated);
|
|
244
|
+
placed.current = true;
|
|
245
|
+
});
|
|
246
|
+
// Once more after a new row has its size (FlashList measures it after the first pass).
|
|
247
|
+
if (animated) later(() => go(true), 180);
|
|
248
|
+
},
|
|
249
|
+
[later, reducedMotion],
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
useImperativeHandle(
|
|
253
|
+
ref,
|
|
254
|
+
() => ({
|
|
255
|
+
scrollToEnd: (options) => {
|
|
256
|
+
setAtBottom(true);
|
|
257
|
+
toBottom(options?.animated ?? true);
|
|
258
|
+
},
|
|
259
|
+
}),
|
|
260
|
+
[setAtBottom, toBottom],
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
// Going to a row: by id, so a page loading in between can't send it to the wrong row.
|
|
264
|
+
const jumpTries = useRef<{ id: string; tries: number } | null>(null);
|
|
265
|
+
const scrollToRow = useCallback(
|
|
266
|
+
(id: string) => {
|
|
267
|
+
const scroll = () => {
|
|
268
|
+
const at = indexOf(id);
|
|
269
|
+
if (at < 0) return;
|
|
270
|
+
// Each try moves the list again: its events don't count until this one settles.
|
|
271
|
+
settlingUntil.current = Date.now() + SETTLING_MS;
|
|
272
|
+
listRef.current?.scrollToIndex?.({ index: at, animated: !reducedMotion, viewPosition: 0.5 });
|
|
273
|
+
};
|
|
274
|
+
jumpTries.current = { id, tries: 0 };
|
|
275
|
+
settlingUntil.current = Date.now() + SETTLING_MS;
|
|
276
|
+
requestAnimationFrame(scroll);
|
|
277
|
+
// Once more after the first layout: on open, FlashList's start-at-the-bottom placement comes after
|
|
278
|
+
// the first frame and would win, leaving the thread at the bottom.
|
|
279
|
+
later(scroll, 250);
|
|
280
|
+
},
|
|
281
|
+
[indexOf, later, reducedMotion],
|
|
282
|
+
);
|
|
283
|
+
const has = useCallback((id: string) => indexOf(id) >= 0, [indexOf]);
|
|
284
|
+
// `has` must change when the rows do, so the jump looks again.
|
|
285
|
+
const hasNow = useMemo(() => (id: string) => has(id), [has, data]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
286
|
+
const { highlightedId, jumping } = useThreadJump({
|
|
287
|
+
target: jumpTo,
|
|
288
|
+
has: hasNow,
|
|
289
|
+
loading,
|
|
290
|
+
loadUntil: onLoadUntil,
|
|
291
|
+
scrollTo: scrollToRow,
|
|
292
|
+
onStart: () => {
|
|
293
|
+
setAtBottom(false);
|
|
294
|
+
placed.current = true;
|
|
295
|
+
},
|
|
296
|
+
onLanded: (id) => {
|
|
297
|
+
// A jump to a row already at the bottom moves nothing, so no scroll event says so: look once it settles.
|
|
298
|
+
// Not before the list's own scrolling has settled (a second try extends it): mid-way, it can still read as the bottom.
|
|
299
|
+
if (recheck.current) clearTimeout(recheck.current);
|
|
300
|
+
const look = () => {
|
|
301
|
+
const wait = settlingUntil.current - Date.now();
|
|
302
|
+
if (wait > 0) {
|
|
303
|
+
recheck.current = setTimeout(look, wait + 50);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
if (metrics.current && threadNearBottom(metrics.current)) setAtBottom(true);
|
|
307
|
+
};
|
|
308
|
+
recheck.current = setTimeout(look, SETTLING_MS + 50);
|
|
309
|
+
const at = indexOf(id);
|
|
310
|
+
const said = at >= 0 ? latest.current.jumpAnnouncement?.(latest.current.data[at]!) : undefined;
|
|
311
|
+
if (said) announce(said);
|
|
312
|
+
},
|
|
313
|
+
onGone: (id) => {
|
|
314
|
+
// Back to where the thread opens: the newest rows.
|
|
315
|
+
setAtBottom(true);
|
|
316
|
+
toBottom(false);
|
|
317
|
+
latest.current.onJumpFailed?.(id);
|
|
318
|
+
},
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
const loadEarlier = useCallback(() => {
|
|
322
|
+
if (placed.current && !jumping && hasEarlier && !loadingEarlier) onLoadEarlier?.();
|
|
323
|
+
}, [hasEarlier, jumping, loadingEarlier, onLoadEarlier]);
|
|
324
|
+
|
|
325
|
+
const earlierProps = { loading: loadingEarlier, onPress: () => onLoadEarlier?.(), label: earlierLabel, testID: `${testID}-earlier` };
|
|
326
|
+
const listHeader = (
|
|
327
|
+
<View>
|
|
328
|
+
{header}
|
|
329
|
+
{hasEarlier && onLoadEarlier ? (renderEarlier ? renderEarlier(earlierProps) : <DefaultEarlier {...earlierProps} />) : null}
|
|
330
|
+
</View>
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
const renderListItem = useCallback(
|
|
334
|
+
({ item, index }: { item: unknown; index: number }) => renderItem(item as T, { index, highlighted: highlightedId !== null && idOf(item as T) === highlightedId }),
|
|
335
|
+
[highlightedId, idOf, renderItem],
|
|
336
|
+
);
|
|
337
|
+
const listKey = useCallback((row: unknown) => keyExtractor(row as T), [keyExtractor]);
|
|
338
|
+
const listItemType = useMemo(() => (getItemType ? (row: unknown) => getItemType(row as T) : undefined), [getItemType]);
|
|
339
|
+
const onScroll = useCallback(
|
|
340
|
+
(e: { nativeEvent: ScrollMetrics }) => {
|
|
341
|
+
metrics.current = { contentOffset: { y: e.nativeEvent.contentOffset.y }, contentSize: { height: e.nativeEvent.contentSize.height }, layoutMeasurement: { height: e.nativeEvent.layoutMeasurement.height } };
|
|
342
|
+
const height = e.nativeEvent.layoutMeasurement.height;
|
|
343
|
+
setViewport((v) => (Math.abs(v - height) < 1 ? v : height));
|
|
344
|
+
// The list's own scroll (to the newest, to a row) isn't the reader moving. Going to a row starts
|
|
345
|
+
// at the bottom, so its first events say "at the bottom": taken, that turned following back on,
|
|
346
|
+
// and FlatList's next layout scrolled to the end, away from the row. After a jump, onLanded
|
|
347
|
+
// looks again once it has settled.
|
|
348
|
+
if (Date.now() < settlingUntil.current) return;
|
|
349
|
+
setAtBottom(threadNearBottom(e.nativeEvent));
|
|
350
|
+
},
|
|
351
|
+
[setAtBottom],
|
|
352
|
+
);
|
|
353
|
+
// The reader's touch ends the list's own scroll: from here their scrolling counts, even mid-jump.
|
|
354
|
+
const onScrollBeginDrag = useCallback(() => {
|
|
355
|
+
settlingUntil.current = 0;
|
|
356
|
+
}, []);
|
|
357
|
+
const onScrollToIndexFailed = useCallback(
|
|
358
|
+
({ index, averageItemLength }: { index: number; averageItemLength: number }) => {
|
|
359
|
+
// FlatList hasn't measured that far up yet: get near it, then try again by id (three times at most).
|
|
360
|
+
listRef.current?.scrollToOffset?.({ offset: Math.max(0, index * averageItemLength - 200), animated: false });
|
|
361
|
+
const target = jumpTries.current;
|
|
362
|
+
if (!target || target.tries >= 3) return;
|
|
363
|
+
target.tries += 1;
|
|
364
|
+
later(() => {
|
|
365
|
+
const at = indexOf(target.id);
|
|
366
|
+
if (at < 0) return;
|
|
367
|
+
settlingUntil.current = Date.now() + SETTLING_MS;
|
|
368
|
+
listRef.current?.scrollToIndex?.({ index: at, animated: !reducedMotion, viewPosition: 0.5 });
|
|
369
|
+
}, 250);
|
|
370
|
+
},
|
|
371
|
+
[indexOf, later, reducedMotion],
|
|
372
|
+
);
|
|
373
|
+
const follow = useCallback(() => {
|
|
374
|
+
if (atBottom.current && !jumping) toBottom(false);
|
|
375
|
+
}, [jumping, toBottom]);
|
|
376
|
+
|
|
377
|
+
if (loading && data.length === 0) {
|
|
378
|
+
return (
|
|
379
|
+
<View testID={`${testID}-loading`} accessible accessibilityLabel="Loading" style={{ flex: 1, justifyContent: "flex-end", padding: 16, gap: 10 }}>
|
|
380
|
+
{loadingView ?? <DefaultLoading />}
|
|
381
|
+
</View>
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (data.length === 0 && empty) {
|
|
386
|
+
return (
|
|
387
|
+
<View testID={testID} style={{ flex: 1, justifyContent: "center" }}>
|
|
388
|
+
{listHeader}
|
|
389
|
+
{empty}
|
|
390
|
+
</View>
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
return (
|
|
395
|
+
<List
|
|
396
|
+
ref={listRef}
|
|
397
|
+
testID={testID}
|
|
398
|
+
accessibilityRole="list"
|
|
399
|
+
data={data as readonly unknown[]}
|
|
400
|
+
renderItem={renderListItem}
|
|
401
|
+
keyExtractor={listKey}
|
|
402
|
+
getItemType={listItemType}
|
|
403
|
+
extraData={highlightedId}
|
|
404
|
+
onStartReached={loadEarlier}
|
|
405
|
+
onStartReachedThreshold={0.5}
|
|
406
|
+
keyboardShouldPersistTaps="handled"
|
|
407
|
+
keyboardDismissMode={Platform.select({ ios: "interactive" as const, default: "on-drag" as const })}
|
|
408
|
+
contentInsetAdjustmentBehavior="automatic"
|
|
409
|
+
contentContainerStyle={{ paddingVertical: 8, paddingHorizontal: 12 }}
|
|
410
|
+
maintainVisibleContentPosition={mode.maintainVisibleContentPosition}
|
|
411
|
+
scrollEventThrottle={32}
|
|
412
|
+
onScroll={onScroll}
|
|
413
|
+
onScrollBeginDrag={onScrollBeginDrag}
|
|
414
|
+
onScrollToIndexFailed={onScrollToIndexFailed}
|
|
415
|
+
{...(mode.followsByHand ? { onContentSizeChange: follow, onLayout: follow } : {})}
|
|
416
|
+
ListHeaderComponent={listHeader}
|
|
417
|
+
ListFooterComponent={footer ? <View>{footer}</View> : null}
|
|
418
|
+
/>
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/** A conversation's list. See the module docs. */
|
|
423
|
+
export const NativeThreadList = forwardRef(NativeThreadListInner) as <T>(
|
|
424
|
+
props: NativeThreadListProps<T> & { ref?: React.Ref<NativeThreadListHandle> },
|
|
425
|
+
) => ReactElement | null;
|
|
426
|
+
|
|
427
|
+
function DefaultEarlier({ loading, label, onPress, testID }: { loading: boolean; label: string; onPress: () => void; testID: string }) {
|
|
428
|
+
const colors = useThemeRoles();
|
|
429
|
+
return (
|
|
430
|
+
<View style={{ alignItems: "center", paddingVertical: 12 }}>
|
|
431
|
+
{loading ? (
|
|
432
|
+
<View testID={`${testID}-loading`} accessible accessibilityLabel={label} accessibilityState={{ busy: true }} style={{ gap: 8, alignItems: "center" }}>
|
|
433
|
+
<NativeSkeleton width={180} height={14} />
|
|
434
|
+
<NativeSkeleton width={120} height={14} />
|
|
435
|
+
</View>
|
|
436
|
+
) : (
|
|
437
|
+
<Pressable testID={testID} accessibilityRole="button" accessibilityLabel={label} onPress={onPress} style={{ minHeight: 44, justifyContent: "center", paddingHorizontal: 16 }}>
|
|
438
|
+
<NativeText preset="label" style={{ color: colors.tint }}>
|
|
439
|
+
{label}
|
|
440
|
+
</NativeText>
|
|
441
|
+
</Pressable>
|
|
442
|
+
)}
|
|
443
|
+
</View>
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function DefaultLoading() {
|
|
448
|
+
return (
|
|
449
|
+
<>
|
|
450
|
+
<NativeSkeleton width={200} height={36} className="rounded-2xl" />
|
|
451
|
+
<View style={{ alignItems: "flex-end" }}>
|
|
452
|
+
<NativeSkeleton width={160} height={36} className="rounded-2xl" />
|
|
453
|
+
</View>
|
|
454
|
+
<NativeSkeleton width={240} height={36} className="rounded-2xl" />
|
|
455
|
+
</>
|
|
456
|
+
);
|
|
457
|
+
}
|
package/src/components/toast.tsx
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
*
|
|
21
21
|
* @stability Beta
|
|
22
22
|
*/
|
|
23
|
+
import { MOTION_DURATIONS, MOTION_EASINGS } from "@marktiderman/genesis-design-system/tokens/motion";
|
|
23
24
|
import {
|
|
24
25
|
createContext,
|
|
25
26
|
useCallback,
|
|
@@ -32,7 +33,7 @@ import {
|
|
|
32
33
|
import { Animated, Pressable, Text } from "react-native";
|
|
33
34
|
import { SafeAreaInsetsContext } from "react-native-safe-area-context";
|
|
34
35
|
import { cn } from "../utils";
|
|
35
|
-
import {
|
|
36
|
+
import { useMotion } from "../hooks/use-motion";
|
|
36
37
|
import { useThemeMode } from "../hooks/use-theme-mode";
|
|
37
38
|
import { useGenesisModules, type GenesisReanimatedModule } from "../native-modules";
|
|
38
39
|
import { useLiquidGlass } from "./glass-surface";
|
|
@@ -79,7 +80,7 @@ export function NativeToastProvider({
|
|
|
79
80
|
disableAnimation = false,
|
|
80
81
|
}: NativeToastProviderProps) {
|
|
81
82
|
const [queue, setQueue] = useState<ToastInstance[]>([]);
|
|
82
|
-
const reducedMotion =
|
|
83
|
+
const reducedMotion = useMotion().reduced;
|
|
83
84
|
|
|
84
85
|
const dismiss = useCallback((id?: number) => {
|
|
85
86
|
setQueue((q) => (id == null ? q.slice(1) : q.filter((t) => t.id !== id)));
|
|
@@ -125,7 +126,8 @@ interface ToastFrameProps extends ToastViewProps {
|
|
|
125
126
|
glass: GlassComponent | null;
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
|
|
129
|
+
// The shared motion tokens: small things appear at `fast`.
|
|
130
|
+
const ENTER_MS = MOTION_DURATIONS.fast;
|
|
129
131
|
|
|
130
132
|
// Reanimated 4 when the app passed it, else React Native's Animated. Two
|
|
131
133
|
// components rather than one with a branch, so each keeps a fixed hook order.
|
|
@@ -195,7 +197,8 @@ function ReanimatedToastView({
|
|
|
195
197
|
useAutoDismiss(toast, onDismiss);
|
|
196
198
|
useEffect(() => {
|
|
197
199
|
if (!animate) return;
|
|
198
|
-
|
|
200
|
+
// The `decelerate` token (a cubic ease-out); a module without `bezier` gets the same curve by name.
|
|
201
|
+
const easing = R.Easing.bezier ? R.Easing.bezier(...MOTION_EASINGS.decelerate) : R.Easing.out(R.Easing.cubic);
|
|
199
202
|
if (fade) opacity.value = R.withTiming(1, { duration: ENTER_MS, easing });
|
|
200
203
|
offset.value = R.withTiming(0, { duration: ENTER_MS, easing });
|
|
201
204
|
// Once per toast: each toast mounts under its own key.
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { useEffect, useState, type ReactNode } from "react";
|
|
2
|
+
import { AccessibilityInfo, View } from "react-native";
|
|
3
|
+
import { titleCase, type WriteConflict } from "@marktiderman/genesis-core";
|
|
4
|
+
import { NativeButton } from "../components/button";
|
|
5
|
+
import { NativeSheet, NativeSheetScrollView } from "../components/sheet";
|
|
6
|
+
import { NativeText } from "../components/text";
|
|
7
|
+
|
|
8
|
+
/** The words NativeConflictSheet shows. The same keys as genesis-ui's `uiMessages.conflict`. */
|
|
9
|
+
export interface NativeConflictSheetMessages {
|
|
10
|
+
/** `{noun}`: the record's noun ("task"). */
|
|
11
|
+
title: string;
|
|
12
|
+
description: string;
|
|
13
|
+
/** When their change already matches what was tried. */
|
|
14
|
+
same: string;
|
|
15
|
+
theirs: string;
|
|
16
|
+
mine: string;
|
|
17
|
+
/** An empty value in the comparison. */
|
|
18
|
+
empty: string;
|
|
19
|
+
/** Their value for a field their row as read here doesn't carry. */
|
|
20
|
+
unknown: string;
|
|
21
|
+
keepMine: string;
|
|
22
|
+
takeTheirs: string;
|
|
23
|
+
/** When "keep mine" failed for another reason (offline, refused). */
|
|
24
|
+
failed: string;
|
|
25
|
+
yes: string;
|
|
26
|
+
no: string;
|
|
27
|
+
/** The noun when the screen gave none. */
|
|
28
|
+
record: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const english: NativeConflictSheetMessages = {
|
|
32
|
+
title: "Someone else changed this {noun}",
|
|
33
|
+
description: "They saved a change after you opened it. Theirs is next to yours below: keep yours to save it over theirs, or take theirs and drop your changes.",
|
|
34
|
+
same: "Their change already matches yours, so there's nothing to choose.",
|
|
35
|
+
theirs: "Theirs",
|
|
36
|
+
mine: "Yours",
|
|
37
|
+
empty: "Empty",
|
|
38
|
+
unknown: "Not shown",
|
|
39
|
+
keepMine: "Keep my version",
|
|
40
|
+
takeTheirs: "Take their version",
|
|
41
|
+
failed: "Your version wasn't saved.",
|
|
42
|
+
yes: "Yes",
|
|
43
|
+
no: "No",
|
|
44
|
+
record: "record",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Props for {@link NativeConflictSheet}.
|
|
49
|
+
*
|
|
50
|
+
* @stability Beta
|
|
51
|
+
*/
|
|
52
|
+
export interface NativeConflictSheetProps {
|
|
53
|
+
/** The conflict to show (`writeConflict(error, values)`); null keeps it closed. */
|
|
54
|
+
conflict: WriteConflict | null;
|
|
55
|
+
/** The record's noun ("task"), for the title. */
|
|
56
|
+
noun?: string;
|
|
57
|
+
/** A field's label. Default: the field name, title-cased. */
|
|
58
|
+
label?: (field: string) => string;
|
|
59
|
+
/** A field's value as shown. Default: plain text. */
|
|
60
|
+
format?: (field: string, value: unknown) => ReactNode;
|
|
61
|
+
/** Save these values over theirs, at the version the conflict reported. The sheet waits for it. */
|
|
62
|
+
onKeepMine: () => void | Promise<void>;
|
|
63
|
+
/** Drop these values and show their row. */
|
|
64
|
+
onTakeTheirs: () => void;
|
|
65
|
+
/** Closed without choosing: the changes stay where they are, unsaved. */
|
|
66
|
+
onDismiss: () => void;
|
|
67
|
+
messages?: Partial<NativeConflictSheetMessages>;
|
|
68
|
+
testID?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function plain(value: unknown, w: NativeConflictSheetMessages): string {
|
|
72
|
+
if (value === null || value === undefined || value === "") return w.empty;
|
|
73
|
+
if (typeof value === "boolean") return value ? w.yes : w.no;
|
|
74
|
+
if (typeof value === "object") {
|
|
75
|
+
try {
|
|
76
|
+
return JSON.stringify(value);
|
|
77
|
+
} catch {
|
|
78
|
+
return String(value);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return String(value);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The phone's ConflictSheet: when a save met someone else's change, a bottom
|
|
86
|
+
* sheet shows their value above the one this person tried to save, for each
|
|
87
|
+
* field where they differ, then "Take theirs" or "Keep mine".
|
|
88
|
+
* NativeRecordView's settings sections open it on a `conflict`.
|
|
89
|
+
*
|
|
90
|
+
* @stability Beta
|
|
91
|
+
*/
|
|
92
|
+
export function NativeConflictSheet({
|
|
93
|
+
conflict,
|
|
94
|
+
noun,
|
|
95
|
+
label = titleCase,
|
|
96
|
+
format,
|
|
97
|
+
onKeepMine,
|
|
98
|
+
onTakeTheirs,
|
|
99
|
+
onDismiss,
|
|
100
|
+
messages,
|
|
101
|
+
testID = "native-conflict-sheet",
|
|
102
|
+
}: NativeConflictSheetProps) {
|
|
103
|
+
const w = { ...english, ...messages };
|
|
104
|
+
const [keeping, setKeeping] = useState(false);
|
|
105
|
+
const [failed, setFailed] = useState<string | null>(null);
|
|
106
|
+
const fields = conflict?.fields ?? [];
|
|
107
|
+
const title = w.title.replace("{noun}", noun ?? w.record);
|
|
108
|
+
// "Keep mine" needs the version their row is at; without one it could only conflict again.
|
|
109
|
+
const canKeep = fields.length > 0 && conflict?.currentVersion != null;
|
|
110
|
+
// Said once as it opens, so a screen reader user knows why a sheet came up.
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
setFailed(null);
|
|
113
|
+
if (conflict) AccessibilityInfo.announceForAccessibility?.(title);
|
|
114
|
+
}, [conflict, title]);
|
|
115
|
+
const has = (field: string) => !!conflict && field in conflict.theirs;
|
|
116
|
+
const text = (field: string, value: unknown, known = true) => (known ? plain(value, w) : w.unknown);
|
|
117
|
+
const show = (field: string, value: unknown, known = true): ReactNode =>
|
|
118
|
+
format && known ? format(field, value) : <NativeText preset="body-sm">{text(field, value, known)}</NativeText>;
|
|
119
|
+
|
|
120
|
+
const keep = async () => {
|
|
121
|
+
setKeeping(true);
|
|
122
|
+
setFailed(null);
|
|
123
|
+
try {
|
|
124
|
+
await onKeepMine();
|
|
125
|
+
} catch (error) {
|
|
126
|
+
setFailed(error instanceof Error && error.message ? error.message : w.failed);
|
|
127
|
+
} finally {
|
|
128
|
+
setKeeping(false);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<NativeSheet
|
|
134
|
+
open={conflict !== null}
|
|
135
|
+
onOpenChange={(open) => !open && !keeping && onDismiss()}
|
|
136
|
+
fitContent
|
|
137
|
+
testID={testID}
|
|
138
|
+
>
|
|
139
|
+
<NativeSheetScrollView>
|
|
140
|
+
<View style={{ gap: 12, paddingHorizontal: 16, paddingVertical: 12 }}>
|
|
141
|
+
<NativeText preset="h4" accessibilityRole="header">
|
|
142
|
+
{title}
|
|
143
|
+
</NativeText>
|
|
144
|
+
<NativeText preset="body-sm" className="text-muted-foreground">
|
|
145
|
+
{fields.length > 0 ? w.description : w.same}
|
|
146
|
+
</NativeText>
|
|
147
|
+
{conflict
|
|
148
|
+
? fields.map((field) => (
|
|
149
|
+
<View key={field} style={{ gap: 4 }} testID={`${testID}-field-${field}`}>
|
|
150
|
+
<NativeText preset="label">{label(field)}</NativeText>
|
|
151
|
+
<View accessible {...(format ? {} : { accessibilityLabel: `${w.theirs}: ${text(field, conflict.theirs[field], has(field))}` })}>
|
|
152
|
+
<NativeText preset="caption" className="text-muted-foreground">{w.theirs}</NativeText>
|
|
153
|
+
{show(field, conflict.theirs[field], has(field))}
|
|
154
|
+
</View>
|
|
155
|
+
<View accessible {...(format ? {} : { accessibilityLabel: `${w.mine}: ${text(field, conflict.mine[field])}` })}>
|
|
156
|
+
<NativeText preset="caption" className="text-muted-foreground">{w.mine}</NativeText>
|
|
157
|
+
{show(field, conflict.mine[field])}
|
|
158
|
+
</View>
|
|
159
|
+
</View>
|
|
160
|
+
))
|
|
161
|
+
: null}
|
|
162
|
+
{failed ? (
|
|
163
|
+
<NativeText preset="body-sm" className="text-destructive" accessibilityRole="alert" testID={`${testID}-failed`}>
|
|
164
|
+
{failed}
|
|
165
|
+
</NativeText>
|
|
166
|
+
) : null}
|
|
167
|
+
<View style={{ gap: 8, paddingTop: 4 }}>
|
|
168
|
+
{canKeep ? (
|
|
169
|
+
<NativeButton size="lg" onPress={() => void keep()} loading={keeping} disabled={keeping} testID={`${testID}-keep-mine`}>
|
|
170
|
+
{w.keepMine}
|
|
171
|
+
</NativeButton>
|
|
172
|
+
) : null}
|
|
173
|
+
<NativeButton size="lg" variant="outline" onPress={onTakeTheirs} disabled={keeping} testID={`${testID}-take-theirs`}>
|
|
174
|
+
{w.takeTheirs}
|
|
175
|
+
</NativeButton>
|
|
176
|
+
</View>
|
|
177
|
+
</View>
|
|
178
|
+
</NativeSheetScrollView>
|
|
179
|
+
</NativeSheet>
|
|
180
|
+
);
|
|
181
|
+
}
|