@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
|
@@ -1,95 +1,87 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ThreadPage — one conversation: messages oldest first, a composer at the
|
|
3
|
-
* bottom that
|
|
4
|
-
*
|
|
3
|
+
* bottom that follows the keyboard, attachments, a read receipt, earlier
|
|
4
|
+
* pages, going to a message, and the first unread.
|
|
5
5
|
*
|
|
6
|
-
* Generic: a support ticket with staff replies, a
|
|
7
|
-
*
|
|
8
|
-
* side on `surface`, over the
|
|
9
|
-
* palette).
|
|
6
|
+
* Generic: a support ticket with staff replies, a help desk thread with
|
|
7
|
+
* internal notes, a direct message, a comment thread. Mine are on the
|
|
8
|
+
* trailing side in the tint, theirs on the leading side on `surface`, over the
|
|
9
|
+
* `groupedBackground` page (SettingsPage's iOS palette). Events ("Sam was
|
|
10
|
+
* assigned") are centred, muted lines between them.
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
-
* and
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* Built from the messaging atoms, so an app can take this whole or build its
|
|
13
|
+
* own from the same parts: `NativeThreadList` (bottom-anchored, holds its
|
|
14
|
+
* place while earlier messages load, follows the newest only at the bottom)
|
|
15
|
+
* and `NativeComposerBar` (grows as you type, modes with a tone, 44pt send).
|
|
16
|
+
*
|
|
17
|
+
* Keyboard: the page sits in `GenesisModules.keyboardAvoidingView`
|
|
18
|
+
* (react-native-keyboard-controller's, `translate-with-padding`: the composer
|
|
19
|
+
* follows the keyboard frame by frame) when the app passed it, else React
|
|
20
|
+
* Native's `KeyboardAvoidingView` (`padding` on iOS, `height` on Android, so
|
|
21
|
+
* under edge-to-edge the composer still clears the keyboard). Dragging the
|
|
22
|
+
* list down dismisses the keyboard (interactively on iOS). The app's
|
|
23
|
+
* `KeyboardScrollProvider` no longer applies here, since a virtualized list
|
|
24
|
+
* can't live in a scroll view: an app that passes it but not
|
|
25
|
+
* `keyboardAvoidingView` gets a development warning saying so.
|
|
26
|
+
*
|
|
27
|
+
* Data: rows arrive as props and the page never fetches. A row's send state
|
|
28
|
+
* is data (`sending`, `pending`, `paused`, `failed`, `conflict`) with
|
|
29
|
+
* `onRetry` / `onDiscard`, whatever feeds it (an outbox, an offline queue).
|
|
30
|
+
* Ids must stay the same across refreshes (a cache, then the server).
|
|
17
31
|
*
|
|
18
32
|
* Read-only: pass `composer={null}` (a closed ticket, a viewer) and an
|
|
19
33
|
* optional `closedNotice`.
|
|
20
34
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
35
|
+
* `loading` shows a skeleton instead of the empty state; `updating` a quiet
|
|
36
|
+
* line while fresher rows arrive.
|
|
37
|
+
*
|
|
38
|
+
* Slots: `message`, `event`, `attachment`, `readReceipt`, `unreadDivider`,
|
|
39
|
+
* `composer`, `composerAccessory` (beside the input: attach a screenshot),
|
|
40
|
+
* `headerRegion` (pinned above the list: a ticket's status and assignee),
|
|
41
|
+
* `header` (scrolls above the first message: what the thread is about),
|
|
42
|
+
* `earlier` and `empty`.
|
|
24
43
|
*
|
|
25
44
|
* @stability Beta
|
|
26
45
|
*/
|
|
27
|
-
import {
|
|
46
|
+
import { memo, useCallback, useEffect, useMemo, useRef, useState, type ComponentType, type ReactNode } from "react";
|
|
28
47
|
import { renderSlot, type SlotPropsFor, type Slots } from "@marktiderman/genesis-core/slots";
|
|
29
|
-
import {
|
|
48
|
+
import { AccessibilityInfo, Image, KeyboardAvoidingView, Platform, Pressable, View } from "react-native";
|
|
30
49
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
31
50
|
import { useThemeRoles } from "../hooks/use-theme-roles";
|
|
32
|
-
import {
|
|
51
|
+
import { useGenesisModules } from "../native-modules";
|
|
52
|
+
import { useKeyboardScroll } from "./keyboard";
|
|
33
53
|
import { NativeEmptyState } from "../components/empty-state";
|
|
34
54
|
import { NativeText } from "../components/text";
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface ThreadMessage {
|
|
49
|
-
id: string;
|
|
50
|
-
body: string;
|
|
51
|
-
/** Sent by the person using the app: trailing side, tint. */
|
|
52
|
-
mine: boolean;
|
|
53
|
-
/** Shown over theirs ("Support"); never over mine. */
|
|
54
|
-
authorName?: string;
|
|
55
|
-
timestamp: string | Date;
|
|
56
|
-
/** An optimistic message: `sending`, then `sent`, or `failed` with `onRetry`. */
|
|
57
|
-
status?: "sending" | "sent" | "failed";
|
|
58
|
-
onRetry?: () => void;
|
|
59
|
-
attachments?: ThreadAttachment[];
|
|
60
|
-
}
|
|
55
|
+
import { NativeComposerBar, type ComposerMode } from "../components/composer-bar";
|
|
56
|
+
import { NativeThreadList, type NativeThreadListHandle, type ThreadRowInfo } from "../components/thread-list";
|
|
57
|
+
import {
|
|
58
|
+
DEFAULT_THREAD_LABELS,
|
|
59
|
+
formatMessageTime,
|
|
60
|
+
readReceiptFor,
|
|
61
|
+
type ThreadAttachment,
|
|
62
|
+
type ThreadComposer,
|
|
63
|
+
type ThreadLabels,
|
|
64
|
+
type ThreadMessage,
|
|
65
|
+
} from "@marktiderman/genesis-core/conversation";
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
onChangeText: (text: string) => void;
|
|
65
|
-
onSend: () => void;
|
|
66
|
-
/** A send is in flight: the button spins and won't send twice. */
|
|
67
|
-
sending?: boolean;
|
|
68
|
-
placeholder?: string;
|
|
69
|
-
sendLabel?: string;
|
|
70
|
-
/** Turns the send button off (besides an empty or blank value). */
|
|
71
|
-
disabled?: boolean;
|
|
72
|
-
maxLength?: number;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** What the default parts say. */
|
|
76
|
-
export interface ThreadLabels {
|
|
77
|
-
/** Who "mine" is, to VoiceOver. */
|
|
78
|
-
you: string;
|
|
79
|
-
sending: string;
|
|
80
|
-
notSent: string;
|
|
81
|
-
retryHint: string;
|
|
82
|
-
}
|
|
67
|
+
const announce = (text: string) => (AccessibilityInfo as { announceForAccessibility?: (t: string) => void }).announceForAccessibility?.(text);
|
|
68
|
+
import { composeHeaderOptions, type ScreenHeaderProps } from "./screen-container";
|
|
83
69
|
|
|
84
|
-
|
|
70
|
+
// The conversation contract is genesis-core's, shared with genesis-ui's ThreadPage.
|
|
71
|
+
export type { MessageTone, ThreadAttachment, ThreadComposer, ThreadLabels, ThreadMessage, ThreadMessageStatus } from "@marktiderman/genesis-core/conversation";
|
|
72
|
+
export { readReceiptFor } from "@marktiderman/genesis-core/conversation";
|
|
85
73
|
|
|
86
74
|
export type ThreadPageSlotMap = {
|
|
87
|
-
message: ThreadMessage & { testID: string; timeLabel: string; showReadReceipt: boolean; labels: ThreadLabels };
|
|
75
|
+
message: ThreadMessage & { testID: string; timeLabel: string; showReadReceipt: boolean; labels: ThreadLabels; /** A jump just landed here (two seconds). */ highlighted: boolean };
|
|
76
|
+
event: ThreadMessage & { testID: string; timeLabel: string };
|
|
88
77
|
attachment: ThreadAttachment & { testID: string; mine: boolean };
|
|
89
78
|
readReceipt: { label: string; testID: string };
|
|
79
|
+
unreadDivider: { label: string; testID: string };
|
|
90
80
|
/** `accessory` is the `composerAccessory` slot, already rendered. */
|
|
91
81
|
composer: ThreadComposer & { testID: string; accessory?: ReactNode };
|
|
92
82
|
composerAccessory: { testID: string };
|
|
83
|
+
/** Pinned above the list: a ticket's status, assignee and priority, and "more". */
|
|
84
|
+
headerRegion: { testID: string };
|
|
93
85
|
header: { testID: string };
|
|
94
86
|
earlier: { loading: boolean; onPress: () => void; label: string; testID: string };
|
|
95
87
|
empty: { title: string; body: string; testID: string };
|
|
@@ -102,7 +94,7 @@ export interface ThreadPageProps extends ScreenHeaderProps {
|
|
|
102
94
|
composer: ThreadComposer | null;
|
|
103
95
|
/** Shown instead of the composer when it is `null` ("This conversation is closed"). */
|
|
104
96
|
closedNotice?: string;
|
|
105
|
-
/** Above the
|
|
97
|
+
/** Above the first message, scrolling with them. Prefer `slots.header` for a component. */
|
|
106
98
|
header?: ReactNode;
|
|
107
99
|
/**
|
|
108
100
|
* When the other side last read the thread. My newest message sent before
|
|
@@ -110,11 +102,29 @@ export interface ThreadPageProps extends ScreenHeaderProps {
|
|
|
110
102
|
*/
|
|
111
103
|
readAt?: string | Date | null;
|
|
112
104
|
readLabel?: string;
|
|
113
|
-
/** There are older messages:
|
|
105
|
+
/** There are older messages: they load near the top, and a "load earlier" button shows. */
|
|
114
106
|
hasEarlier?: boolean;
|
|
115
107
|
onLoadEarlier?: () => void;
|
|
116
108
|
loadingEarlier?: boolean;
|
|
117
109
|
earlierLabel?: string;
|
|
110
|
+
/** The first message the reader hasn't seen: a "New messages" divider above it. */
|
|
111
|
+
firstUnreadId?: string | null;
|
|
112
|
+
/** Go to this message (a search result, a pinned one), loading with `onLoadUntil` until it's here. */
|
|
113
|
+
jumpTo?: string | null;
|
|
114
|
+
/** Load earlier pages until the message is held; resolve false when it can't be found. */
|
|
115
|
+
onLoadUntil?: (id: string) => Promise<boolean>;
|
|
116
|
+
/** A `jumpTo` message couldn't be found (the list goes back to the newest). Default: VoiceOver says `labels.messageGone`. */
|
|
117
|
+
onJumpFailed?: (id: string) => void;
|
|
118
|
+
/** The first page is loading: a skeleton instead of the empty state, and a jump waits for it. */
|
|
119
|
+
loading?: boolean;
|
|
120
|
+
/** Fresher rows are on their way (the cache showed first): a quiet "Updating…" line under the header region, announced once. */
|
|
121
|
+
updating?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* For the keyboard. With the keyboard-controller module the page finds its own place on screen
|
|
124
|
+
* (`automaticOffset`) and this is extra space (default 0); with React Native's, it's where the
|
|
125
|
+
* page starts below the window's top (default 100 on iOS: a standard header).
|
|
126
|
+
*/
|
|
127
|
+
keyboardVerticalOffset?: number;
|
|
118
128
|
emptyTitle?: string;
|
|
119
129
|
emptyBody?: string;
|
|
120
130
|
formatTime?: (date: Date) => string;
|
|
@@ -140,23 +150,25 @@ export function getThreadPageStackOptions(props: ScreenHeaderProps & { headerTit
|
|
|
140
150
|
|
|
141
151
|
const toDate = (value: string | Date) => (typeof value === "string" ? new Date(value) : value);
|
|
142
152
|
|
|
143
|
-
function defaultTime(date: Date): string {
|
|
144
|
-
return date.toLocaleString(undefined, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" });
|
|
145
|
-
}
|
|
146
153
|
|
|
147
|
-
/** The newest of my messages the other side has read, or null. */
|
|
148
|
-
export function readReceiptFor(messages: readonly ThreadMessage[], readAt: string | Date | null | undefined): string | null {
|
|
149
|
-
if (!readAt) return null;
|
|
150
|
-
const read = toDate(readAt).getTime();
|
|
151
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
152
|
-
const m = messages[i]!;
|
|
153
|
-
if (m.mine && m.status !== "sending" && m.status !== "failed" && toDate(m.timestamp).getTime() <= read) return m.id;
|
|
154
|
-
}
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
154
|
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
const NO_SLOTS: Slots<ThreadPageSlotMap> = {};
|
|
156
|
+
const NO_SLOT_PROPS: SlotPropsFor<ThreadPageSlotMap> = {};
|
|
157
|
+
const messageKey = (m: ThreadMessage) => m.id;
|
|
158
|
+
const messageType = (m: ThreadMessage) => (m.kind === "event" ? "event" : m.mine ? "mine" : "theirs");
|
|
159
|
+
|
|
160
|
+
declare const __DEV__: boolean | undefined;
|
|
161
|
+
declare const process: { env: Record<string, string | undefined> } | undefined;
|
|
162
|
+
let warnedNoKeyboardModule = false;
|
|
163
|
+
/** Development-only: the app has keyboard-controller (it passed a keyboard scroll view) but not its KeyboardAvoidingView. */
|
|
164
|
+
function warnNoKeyboardModule() {
|
|
165
|
+
const dev = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env.NODE_ENV !== "production";
|
|
166
|
+
if (!dev || warnedNoKeyboardModule) return;
|
|
167
|
+
warnedNoKeyboardModule = true;
|
|
168
|
+
// genesis-allow-console: a development-only setup warning, like AuthScreen's
|
|
169
|
+
console.warn(
|
|
170
|
+
"[genesis] ThreadPage: react-native-keyboard-controller is set up (keyboardScroll) but GenesisModules.keyboardAvoidingView isn't, so the composer falls back to React Native's KeyboardAvoidingView. Pass keyboard-controller's KeyboardAvoidingView as `keyboardAvoidingView` in your Genesis modules.",
|
|
171
|
+
);
|
|
160
172
|
}
|
|
161
173
|
|
|
162
174
|
export function ThreadPage({
|
|
@@ -170,88 +182,105 @@ export function ThreadPage({
|
|
|
170
182
|
onLoadEarlier,
|
|
171
183
|
loadingEarlier = false,
|
|
172
184
|
earlierLabel = "Load earlier messages",
|
|
185
|
+
firstUnreadId,
|
|
186
|
+
jumpTo,
|
|
187
|
+
onLoadUntil,
|
|
188
|
+
onJumpFailed,
|
|
189
|
+
loading = false,
|
|
190
|
+
updating = false,
|
|
191
|
+
keyboardVerticalOffset,
|
|
173
192
|
emptyTitle,
|
|
174
193
|
emptyBody,
|
|
175
|
-
formatTime =
|
|
194
|
+
formatTime = formatMessageTime,
|
|
176
195
|
labels: labelOverrides,
|
|
177
|
-
slots =
|
|
178
|
-
slotProps =
|
|
196
|
+
slots = NO_SLOTS,
|
|
197
|
+
slotProps = NO_SLOT_PROPS,
|
|
179
198
|
testID = "thread-page",
|
|
180
199
|
}: ThreadPageProps) {
|
|
181
200
|
const colors = useThemeRoles();
|
|
182
|
-
const
|
|
183
|
-
const
|
|
201
|
+
const genesis = useGenesisModules();
|
|
202
|
+
const listRef = useRef<NativeThreadListHandle | null>(null);
|
|
203
|
+
const [atBottom, setAtBottom] = useState(true);
|
|
184
204
|
const receiptFor = readReceiptFor(messages, readAt);
|
|
185
|
-
|
|
186
|
-
const
|
|
205
|
+
// Kept stable across renders (typing in the composer) unless the words change, so rows don't re-render.
|
|
206
|
+
const labelsKey = labelOverrides ? JSON.stringify(labelOverrides) : "";
|
|
207
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
208
|
+
const labels: ThreadLabels = useMemo(() => ({ ...DEFAULT_THREAD_LABELS, ...labelOverrides }), [labelsKey]);
|
|
209
|
+
const keyboardScroll = useKeyboardScroll();
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
if (keyboardScroll && !genesis.keyboardAvoidingView) warnNoKeyboardModule();
|
|
212
|
+
}, [keyboardScroll, genesis.keyboardAvoidingView]);
|
|
187
213
|
|
|
188
|
-
//
|
|
214
|
+
// "Updating…" on iOS too (a live region is Android-only).
|
|
189
215
|
useEffect(() => {
|
|
190
|
-
|
|
191
|
-
|
|
216
|
+
if (updating && Platform.OS === "ios") announce(labels.updating);
|
|
217
|
+
// labels.updating is read when updating turns on.
|
|
218
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
219
|
+
}, [updating]);
|
|
192
220
|
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
</View>
|
|
239
|
-
) : null}
|
|
240
|
-
{message.id === receiptFor
|
|
241
|
-
? renderSlot(DefaultReadReceipt, slots.readReceipt, { label: readLabel, testID: `${testID}-read-receipt` }, slotProps.readReceipt)
|
|
242
|
-
: null}
|
|
243
|
-
</View>
|
|
244
|
-
))}
|
|
245
|
-
</View>
|
|
246
|
-
</View>
|
|
221
|
+
const renderRow = useCallback(
|
|
222
|
+
(message: ThreadMessage, { highlighted }: ThreadRowInfo) => {
|
|
223
|
+
const timeLabel = formatTime(toDate(message.timestamp));
|
|
224
|
+
const divider =
|
|
225
|
+
message.id === firstUnreadId
|
|
226
|
+
? renderSlot(DefaultUnreadDivider, slots.unreadDivider, { label: labels.newMessages, testID: `${testID}-unread` }, slotProps.unreadDivider)
|
|
227
|
+
: null;
|
|
228
|
+
if (message.kind === "event") {
|
|
229
|
+
return (
|
|
230
|
+
<View style={{ paddingVertical: 3 }}>
|
|
231
|
+
{divider}
|
|
232
|
+
{renderSlot(DefaultEvent, slots.event, { ...message, testID: `${testID}-event-${message.id}`, timeLabel }, slotProps.event)}
|
|
233
|
+
</View>
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
return (
|
|
237
|
+
<View style={{ paddingVertical: 3 }}>
|
|
238
|
+
{divider}
|
|
239
|
+
{renderSlot(
|
|
240
|
+
DefaultMessage,
|
|
241
|
+
slots.message,
|
|
242
|
+
{ ...message, testID: `${testID}-message-${message.id}`, timeLabel, showReadReceipt: message.id === receiptFor, labels, highlighted },
|
|
243
|
+
slotProps.message,
|
|
244
|
+
)}
|
|
245
|
+
{message.attachments?.length ? (
|
|
246
|
+
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 6, justifyContent: message.mine ? "flex-end" : "flex-start", marginTop: 4 }}>
|
|
247
|
+
{message.attachments.map((attachment) => (
|
|
248
|
+
<View key={attachment.id}>
|
|
249
|
+
{renderSlot(
|
|
250
|
+
DefaultAttachment,
|
|
251
|
+
slots.attachment,
|
|
252
|
+
{ ...attachment, mine: message.mine, testID: `${testID}-attachment-${attachment.id}` },
|
|
253
|
+
slotProps.attachment,
|
|
254
|
+
)}
|
|
255
|
+
</View>
|
|
256
|
+
))}
|
|
257
|
+
</View>
|
|
258
|
+
) : null}
|
|
259
|
+
{message.id === receiptFor
|
|
260
|
+
? renderSlot(DefaultReadReceipt, slots.readReceipt, { label: readLabel, testID: `${testID}-read-receipt` }, slotProps.readReceipt)
|
|
261
|
+
: null}
|
|
262
|
+
</View>
|
|
263
|
+
);
|
|
264
|
+
},
|
|
265
|
+
[firstUnreadId, formatTime, receiptFor, readLabel, slots, slotProps, testID, labels],
|
|
247
266
|
);
|
|
248
267
|
|
|
268
|
+
const send = composer
|
|
269
|
+
? () => {
|
|
270
|
+
composer.onSend();
|
|
271
|
+
// What you send is what you look at next, wherever the list was.
|
|
272
|
+
listRef.current?.scrollToEnd({ animated: true });
|
|
273
|
+
}
|
|
274
|
+
: undefined;
|
|
275
|
+
|
|
249
276
|
const footer = composer ? (
|
|
250
277
|
renderSlot(
|
|
251
278
|
DefaultComposer,
|
|
252
279
|
slots.composer,
|
|
253
280
|
{
|
|
254
281
|
...composer,
|
|
282
|
+
sendingLabel: composer.sendingLabel ?? labels.sending,
|
|
283
|
+
onSend: send!,
|
|
255
284
|
testID: `${testID}-composer`,
|
|
256
285
|
accessory: renderSlot(Nothing, slots.composerAccessory, { testID: `${testID}-composer-accessory` }, slotProps.composerAccessory),
|
|
257
286
|
},
|
|
@@ -263,45 +292,66 @@ export function ThreadPage({
|
|
|
263
292
|
</NativeText>
|
|
264
293
|
) : null;
|
|
265
294
|
|
|
266
|
-
const
|
|
267
|
-
|
|
295
|
+
const listHeader = header ?? renderSlot(Nothing, slots.header, { testID: `${testID}-header` }, slotProps.header);
|
|
296
|
+
|
|
297
|
+
const KeyboardAvoiding = (genesis.keyboardAvoidingView ?? KeyboardAvoidingView) as ComponentType<Record<string, unknown>>;
|
|
298
|
+
const keyboardProps = genesis.keyboardAvoidingView
|
|
299
|
+
? { behavior: "translate-with-padding", automaticOffset: true, keyboardVerticalOffset: keyboardVerticalOffset ?? 0 }
|
|
300
|
+
: { behavior: Platform.OS === "ios" ? "padding" : "height", keyboardVerticalOffset: keyboardVerticalOffset ?? (Platform.OS === "ios" ? 100 : 0) };
|
|
268
301
|
|
|
269
|
-
if (KeyboardScroll) {
|
|
270
|
-
// The composer scrolls with the messages, so the keyboard-aware view keeps it (the focused input) above the keyboard.
|
|
271
|
-
return (
|
|
272
|
-
<SafeAreaView testID={testID} edges={["left", "right", "bottom"]} style={page}>
|
|
273
|
-
{createElement(
|
|
274
|
-
KeyboardScroll as never,
|
|
275
|
-
{
|
|
276
|
-
ref: scrollRef,
|
|
277
|
-
testID: `${testID}-keyboard`,
|
|
278
|
-
keyboardShouldPersistTaps: "handled",
|
|
279
|
-
contentInsetAdjustmentBehavior: "automatic",
|
|
280
|
-
contentContainerStyle: { flexGrow: 1 },
|
|
281
|
-
bottomOffset: 8,
|
|
282
|
-
onContentSizeChange,
|
|
283
|
-
} as never,
|
|
284
|
-
body,
|
|
285
|
-
footer,
|
|
286
|
-
)}
|
|
287
|
-
</SafeAreaView>
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
302
|
return (
|
|
291
|
-
<SafeAreaView testID={testID} edges={["left", "right", "bottom"]} style={
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
>
|
|
301
|
-
|
|
302
|
-
|
|
303
|
+
<SafeAreaView testID={testID} edges={["left", "right", "bottom"]} style={{ flex: 1, backgroundColor: colors.groupedBackground }}>
|
|
304
|
+
{/* Pinned above the keyboard-avoiding view, so it doesn't move with the keyboard. */}
|
|
305
|
+
{renderSlot(Nothing, slots.headerRegion, { testID: `${testID}-header-region` }, slotProps.headerRegion)}
|
|
306
|
+
{updating ? (
|
|
307
|
+
<View testID={`${testID}-updating`} accessibilityLiveRegion="polite" accessible accessibilityLabel={labels.updating}>
|
|
308
|
+
<NativeText style={{ textAlign: "center", paddingVertical: 4, color: colors.tertiaryLabel, fontSize: 12, lineHeight: 16 }}>{labels.updating}</NativeText>
|
|
309
|
+
</View>
|
|
310
|
+
) : null}
|
|
311
|
+
<KeyboardAvoiding testID={`${testID}-keyboard`} style={{ flex: 1 }} {...keyboardProps}>
|
|
312
|
+
<View style={{ flex: 1 }}>
|
|
313
|
+
<NativeThreadList<ThreadMessage>
|
|
314
|
+
ref={listRef}
|
|
315
|
+
testID={`${testID}-messages`}
|
|
316
|
+
data={messages}
|
|
317
|
+
keyExtractor={messageKey}
|
|
318
|
+
getItemType={messageType}
|
|
319
|
+
renderItem={renderRow}
|
|
320
|
+
loading={loading}
|
|
321
|
+
hasEarlier={hasEarlier}
|
|
322
|
+
onLoadEarlier={onLoadEarlier}
|
|
323
|
+
loadingEarlier={loadingEarlier}
|
|
324
|
+
earlierLabel={earlierLabel}
|
|
325
|
+
renderEarlier={(p) => renderSlot(DefaultEarlierButton, slots.earlier, { ...p, testID: `${testID}-earlier` }, slotProps.earlier)}
|
|
326
|
+
jumpTo={jumpTo}
|
|
327
|
+
onLoadUntil={onLoadUntil}
|
|
328
|
+
jumpAnnouncement={(m) => [m.mine ? labels.you : m.authorName, m.body].filter(Boolean).join(", ")}
|
|
329
|
+
onJumpFailed={onJumpFailed ?? (() => announce(labels.messageGone))}
|
|
330
|
+
onAtBottomChange={setAtBottom}
|
|
331
|
+
header={listHeader}
|
|
332
|
+
empty={renderSlot(
|
|
333
|
+
DefaultEmpty,
|
|
334
|
+
slots.empty,
|
|
335
|
+
{ title: emptyTitle ?? "No messages yet", body: emptyBody ?? "Write the first one below.", testID: `${testID}-empty` },
|
|
336
|
+
slotProps.empty,
|
|
337
|
+
)}
|
|
338
|
+
/>
|
|
339
|
+
{!atBottom && messages.length > 0 ? (
|
|
340
|
+
<Pressable
|
|
341
|
+
testID={`${testID}-jump-latest`}
|
|
342
|
+
accessibilityRole="button"
|
|
343
|
+
accessibilityLabel={labels.jumpToLatest}
|
|
344
|
+
onPress={() => listRef.current?.scrollToEnd({ animated: true })}
|
|
345
|
+
style={{ position: "absolute", bottom: 8, alignSelf: "center", minHeight: 44, justifyContent: "center", paddingHorizontal: 16, borderRadius: 22, backgroundColor: colors.surface }}
|
|
346
|
+
>
|
|
347
|
+
<NativeText preset="label" style={{ color: colors.tint }}>
|
|
348
|
+
{labels.jumpToLatest}
|
|
349
|
+
</NativeText>
|
|
350
|
+
</Pressable>
|
|
351
|
+
) : null}
|
|
352
|
+
</View>
|
|
303
353
|
{footer}
|
|
304
|
-
</
|
|
354
|
+
</KeyboardAvoiding>
|
|
305
355
|
</SafeAreaView>
|
|
306
356
|
);
|
|
307
357
|
}
|
|
@@ -310,13 +360,14 @@ function Nothing(_props: { testID: string }) {
|
|
|
310
360
|
return null;
|
|
311
361
|
}
|
|
312
362
|
|
|
313
|
-
function
|
|
363
|
+
function DefaultEarlierButton({ loading, onPress, label, testID }: ThreadPageSlotMap["earlier"]) {
|
|
364
|
+
const colors = useThemeRoles();
|
|
314
365
|
return (
|
|
315
|
-
<
|
|
316
|
-
<
|
|
366
|
+
<Pressable testID={testID} accessibilityRole="button" accessibilityLabel={label} accessibilityState={{ busy: loading }} onPress={onPress} disabled={loading} style={{ minHeight: 44, alignItems: "center", justifyContent: "center" }}>
|
|
367
|
+
<NativeText preset="label" style={{ color: colors.tint }}>
|
|
317
368
|
{label}
|
|
318
|
-
</
|
|
319
|
-
</
|
|
369
|
+
</NativeText>
|
|
370
|
+
</Pressable>
|
|
320
371
|
);
|
|
321
372
|
}
|
|
322
373
|
|
|
@@ -324,16 +375,62 @@ function DefaultEmpty({ title, body, testID }: ThreadPageSlotMap["empty"]) {
|
|
|
324
375
|
return <NativeEmptyState variant="first-run" title={title} body={body} testID={testID} />;
|
|
325
376
|
}
|
|
326
377
|
|
|
378
|
+
function DefaultUnreadDivider({ label, testID }: ThreadPageSlotMap["unreadDivider"]) {
|
|
379
|
+
const colors = useThemeRoles();
|
|
380
|
+
return (
|
|
381
|
+
<View testID={testID} accessible accessibilityRole="header" accessibilityLabel={label} style={{ flexDirection: "row", alignItems: "center", gap: 8, paddingVertical: 8 }}>
|
|
382
|
+
<View style={{ flex: 1, height: 1, backgroundColor: colors.tint }} />
|
|
383
|
+
<NativeText style={{ color: colors.tint, fontSize: 12, lineHeight: 16 }}>{label}</NativeText>
|
|
384
|
+
<View style={{ flex: 1, height: 1, backgroundColor: colors.tint }} />
|
|
385
|
+
</View>
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
function DefaultEvent({ body, timeLabel, testID }: ThreadPageSlotMap["event"]) {
|
|
390
|
+
const colors = useThemeRoles();
|
|
391
|
+
return (
|
|
392
|
+
<View testID={testID} accessible accessibilityLabel={`${body}, ${timeLabel}`} style={{ alignSelf: "center", paddingHorizontal: 12, paddingVertical: 4, borderRadius: 12, backgroundColor: colors.fill }}>
|
|
393
|
+
<NativeText style={{ color: colors.secondaryLabel, fontSize: 12, lineHeight: 16, textAlign: "center" }}>{body}</NativeText>
|
|
394
|
+
</View>
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
|
|
327
398
|
// No `color` key on mine: an undefined color in the style would override the class's.
|
|
328
399
|
const MINE_TEXT = { fontSize: 17, lineHeight: 22 } as const;
|
|
329
400
|
|
|
330
|
-
|
|
401
|
+
/** What a message's state says under it, or null when it's sent. */
|
|
402
|
+
function stateLabel(message: ThreadPageSlotMap["message"]): string | null {
|
|
403
|
+
const { labels } = message;
|
|
404
|
+
switch (message.status) {
|
|
405
|
+
case "sending":
|
|
406
|
+
return labels.sending;
|
|
407
|
+
case "pending":
|
|
408
|
+
return labels.pending;
|
|
409
|
+
case "paused":
|
|
410
|
+
return labels.paused;
|
|
411
|
+
case "failed":
|
|
412
|
+
return labels.notSent;
|
|
413
|
+
case "conflict":
|
|
414
|
+
return labels.conflict;
|
|
415
|
+
default:
|
|
416
|
+
return null;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const DefaultMessage = memo(function DefaultMessage(message: ThreadPageSlotMap["message"]) {
|
|
331
421
|
const colors = useThemeRoles();
|
|
332
|
-
const failed = message.status === "failed";
|
|
333
422
|
const { labels } = message;
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
|
|
423
|
+
const broken = message.status === "failed" || message.status === "conflict";
|
|
424
|
+
const waiting = message.status === "sending" || message.status === "pending" || message.status === "paused";
|
|
425
|
+
const internal = message.tone === "internal";
|
|
426
|
+
const state = stateLabel(message);
|
|
427
|
+
const label = [message.mine ? labels.you : (message.authorName ?? ""), internal ? labels.internal : null, message.body, message.timeLabel, state].filter(Boolean).join(", ");
|
|
428
|
+
// Discard is offered for a message that hasn't gone: not while it's sending (it may already be on the server).
|
|
429
|
+
const canDiscard = Boolean(message.onDiscard) && (broken || message.status === "pending" || message.status === "paused");
|
|
430
|
+
const actions = [
|
|
431
|
+
...(broken && message.onRetry ? [{ name: "activate", label: labels.retryHint }] : []),
|
|
432
|
+
...(canDiscard ? [{ name: "discard", label: labels.discard }] : []),
|
|
433
|
+
];
|
|
337
434
|
return (
|
|
338
435
|
<View style={{ alignItems: message.mine ? "flex-end" : "flex-start" }}>
|
|
339
436
|
{!message.mine && message.authorName ? (
|
|
@@ -342,38 +439,57 @@ function DefaultMessage(message: ThreadPageSlotMap["message"]) {
|
|
|
342
439
|
<Pressable
|
|
343
440
|
testID={message.testID}
|
|
344
441
|
accessible
|
|
442
|
+
accessibilityRole={broken && message.onRetry ? "button" : undefined}
|
|
345
443
|
accessibilityLabel={label}
|
|
346
|
-
accessibilityHint={
|
|
347
|
-
|
|
444
|
+
accessibilityHint={broken && message.onRetry ? labels.retryHint : undefined}
|
|
445
|
+
accessibilityActions={actions.length ? actions : undefined}
|
|
446
|
+
onAccessibilityAction={(e) => {
|
|
447
|
+
if (e.nativeEvent.actionName === "discard" && canDiscard) message.onDiscard?.();
|
|
448
|
+
else if (e.nativeEvent.actionName === "activate" && broken) message.onRetry?.();
|
|
449
|
+
}}
|
|
450
|
+
onPress={broken ? message.onRetry : undefined}
|
|
348
451
|
style={{
|
|
349
452
|
maxWidth: "80%",
|
|
350
453
|
paddingHorizontal: 14,
|
|
351
454
|
paddingVertical: 8,
|
|
352
455
|
borderRadius: 18,
|
|
353
|
-
backgroundColor: message.mine ? colors.tint : colors.surface,
|
|
354
|
-
|
|
456
|
+
backgroundColor: internal ? colors.surface : message.mine ? colors.tint : colors.surface,
|
|
457
|
+
borderWidth: internal || message.highlighted ? 2 : 0,
|
|
458
|
+
borderColor: internal ? colors.warning : colors.tint,
|
|
459
|
+
opacity: waiting ? 0.6 : 1,
|
|
355
460
|
}}
|
|
356
461
|
>
|
|
357
|
-
<NativeText className={message.mine ? "text-primary-foreground" : undefined} style={message.mine ? MINE_TEXT : { ...MINE_TEXT, color: colors.label }}>
|
|
462
|
+
<NativeText className={message.mine && !internal ? "text-primary-foreground" : undefined} style={message.mine && !internal ? MINE_TEXT : { ...MINE_TEXT, color: colors.label }}>
|
|
358
463
|
{message.body}
|
|
359
464
|
</NativeText>
|
|
360
465
|
</Pressable>
|
|
361
|
-
<
|
|
362
|
-
testID={`${message.testID}-time`}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
{
|
|
366
|
-
|
|
466
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 8, marginTop: 2, marginHorizontal: 12 }}>
|
|
467
|
+
<NativeText testID={`${message.testID}-time`} style={{ color: broken ? colors.destructive : colors.tertiaryLabel, fontSize: 11, lineHeight: 14 }}>
|
|
468
|
+
{state ?? message.timeLabel}
|
|
469
|
+
</NativeText>
|
|
470
|
+
{canDiscard ? (
|
|
471
|
+
<Pressable testID={`${message.testID}-discard`} accessibilityRole="button" accessibilityLabel={labels.discard} onPress={message.onDiscard} hitSlop={{ top: 15, bottom: 15, left: 12, right: 12 }}>
|
|
472
|
+
<NativeText style={{ color: colors.secondaryLabel, fontSize: 11, lineHeight: 14 }}>{labels.discard}</NativeText>
|
|
473
|
+
</Pressable>
|
|
474
|
+
) : null}
|
|
475
|
+
</View>
|
|
367
476
|
</View>
|
|
368
477
|
);
|
|
369
|
-
}
|
|
478
|
+
});
|
|
370
479
|
|
|
371
|
-
function DefaultAttachment({ uri, width, height, accessibilityLabel, onPress, testID }: ThreadPageSlotMap["attachment"]) {
|
|
480
|
+
function DefaultAttachment({ id, uri, width, height, accessibilityLabel, onPress, testID }: ThreadPageSlotMap["attachment"]) {
|
|
481
|
+
const { image: ExpoImage } = useGenesisModules();
|
|
372
482
|
const ratio = width && height ? width / height : 0.6;
|
|
373
483
|
const w = 140;
|
|
484
|
+
const style = { width: w, height: Math.round(w / ratio), borderRadius: 12 };
|
|
374
485
|
return (
|
|
375
486
|
<Pressable testID={testID} accessibilityRole="image" accessibilityLabel={accessibilityLabel ?? "Attachment"} onPress={onPress} disabled={!onPress}>
|
|
376
|
-
|
|
487
|
+
{/* A recycled row (FlashList) must not show the last row's picture while this one loads. */}
|
|
488
|
+
{ExpoImage ? (
|
|
489
|
+
<ExpoImage source={{ uri }} style={style} contentFit="cover" recyclingKey={id} />
|
|
490
|
+
) : (
|
|
491
|
+
<Image key={uri} source={{ uri }} style={style} resizeMode="cover" />
|
|
492
|
+
)}
|
|
377
493
|
</Pressable>
|
|
378
494
|
);
|
|
379
495
|
}
|
|
@@ -387,58 +503,6 @@ function DefaultReadReceipt({ label, testID }: ThreadPageSlotMap["readReceipt"])
|
|
|
387
503
|
);
|
|
388
504
|
}
|
|
389
505
|
|
|
390
|
-
function DefaultComposer({
|
|
391
|
-
|
|
392
|
-
onChangeText,
|
|
393
|
-
onSend,
|
|
394
|
-
sending = false,
|
|
395
|
-
placeholder = "Message",
|
|
396
|
-
sendLabel = "Send",
|
|
397
|
-
disabled = false,
|
|
398
|
-
maxLength,
|
|
399
|
-
testID,
|
|
400
|
-
accessory,
|
|
401
|
-
}: ThreadPageSlotMap["composer"]) {
|
|
402
|
-
const colors = useThemeRoles();
|
|
403
|
-
const blank = !value.trim();
|
|
404
|
-
return (
|
|
405
|
-
<View
|
|
406
|
-
testID={testID}
|
|
407
|
-
style={{ flexDirection: "row", alignItems: "flex-end", gap: 8, paddingHorizontal: 12, paddingTop: 8, paddingBottom: 8, backgroundColor: colors.groupedBackground }}
|
|
408
|
-
>
|
|
409
|
-
{accessory}
|
|
410
|
-
<TextInput
|
|
411
|
-
testID={`${testID}-input`}
|
|
412
|
-
value={value}
|
|
413
|
-
onChangeText={onChangeText}
|
|
414
|
-
placeholder={placeholder}
|
|
415
|
-
placeholderTextColor={colors.tertiaryLabel as string}
|
|
416
|
-
accessibilityLabel={placeholder}
|
|
417
|
-
multiline
|
|
418
|
-
maxLength={maxLength}
|
|
419
|
-
editable={!sending}
|
|
420
|
-
style={{
|
|
421
|
-
flex: 1,
|
|
422
|
-
minHeight: 36,
|
|
423
|
-
maxHeight: 120,
|
|
424
|
-
paddingHorizontal: 14,
|
|
425
|
-
paddingTop: 8,
|
|
426
|
-
paddingBottom: 8,
|
|
427
|
-
borderRadius: 18,
|
|
428
|
-
fontSize: 17,
|
|
429
|
-
color: colors.label as string,
|
|
430
|
-
backgroundColor: colors.surface,
|
|
431
|
-
}}
|
|
432
|
-
/>
|
|
433
|
-
{sending ? (
|
|
434
|
-
<View style={{ height: 36, justifyContent: "center", paddingHorizontal: 8 }}>
|
|
435
|
-
<ActivityIndicator testID={`${testID}-sending`} accessibilityLabel="Sending" />
|
|
436
|
-
</View>
|
|
437
|
-
) : (
|
|
438
|
-
<NativeButton size="sm" onPress={onSend} disabled={disabled || blank} testID={`${testID}-send`}>
|
|
439
|
-
{sendLabel}
|
|
440
|
-
</NativeButton>
|
|
441
|
-
)}
|
|
442
|
-
</View>
|
|
443
|
-
);
|
|
506
|
+
function DefaultComposer({ accessory, testID, ...composer }: ThreadPageSlotMap["composer"]) {
|
|
507
|
+
return <NativeComposerBar {...composer} leading={accessory} testID={testID} />;
|
|
444
508
|
}
|