@poolse/react-native 3.2.0 → 3.4.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/CHANGELOG.md +74 -0
- package/README.md +55 -4
- package/dist/index.cjs +1633 -801
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +311 -121
- package/dist/index.d.ts +311 -121
- package/dist/index.js +1634 -802
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode, ReactElement } from 'react';
|
|
3
3
|
import { Conversation, Uuid, Message, LiveCall, AttachmentUploadInput, Membership, Attachment } from '@poolse/sdk';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { GroupPosition } from '@poolse/react';
|
|
6
|
+
import { ThemeInput, ColorSchemePreference, NativeThemeOptions, NativeTheme } from '@poolse/theme';
|
|
5
7
|
|
|
6
8
|
interface InboxUser {
|
|
7
9
|
/** The user's external_id (the same id you mint JWTs with). */
|
|
@@ -76,15 +78,237 @@ interface PoolseInboxHandle {
|
|
|
76
78
|
*/
|
|
77
79
|
declare const PoolseInbox: react.ForwardRefExoticComponent<PoolseInboxProps & react.RefAttributes<PoolseInboxHandle>>;
|
|
78
80
|
|
|
81
|
+
/**
|
|
82
|
+
* - `bubbles` — chat bubbles, own messages on the right (the default).
|
|
83
|
+
* - `list` — Slack-style full-width rows: avatar, name and time once
|
|
84
|
+
* per run of messages.
|
|
85
|
+
* - `compact` — Discord/IRC-style dense lines: time, coloured name and
|
|
86
|
+
* text on one line.
|
|
87
|
+
*/
|
|
88
|
+
type ChatLayout = 'bubbles' | 'list' | 'compact';
|
|
89
|
+
type ChatDensity = 'comfortable' | 'compact';
|
|
90
|
+
/** `'12h'`, `'24h'`, or your own formatter. Omitted: the locale's default. */
|
|
91
|
+
type TimeFormat = '12h' | '24h' | ((date: Date) => string);
|
|
92
|
+
/** What each slot function receives. */
|
|
93
|
+
interface MessageSlotProps {
|
|
94
|
+
message: Message;
|
|
95
|
+
/** The viewer sent it. */
|
|
96
|
+
isSelf: boolean;
|
|
97
|
+
sender: MessageUser;
|
|
98
|
+
layout: ChatLayout;
|
|
99
|
+
/** First message of a same-sender run (always true in `compact`). */
|
|
100
|
+
isRunStart: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* What the slot renders by default (may be `null` — e.g. no header on
|
|
103
|
+
* a continuation message). Return it to keep the default, wrap it,
|
|
104
|
+
* or return something else.
|
|
105
|
+
*/
|
|
106
|
+
children: ReactNode;
|
|
107
|
+
}
|
|
108
|
+
type MessageSlot = (props: MessageSlotProps) => ReactNode;
|
|
109
|
+
/**
|
|
110
|
+
* Replace or wrap one part of every message, in any layout:
|
|
111
|
+
*
|
|
112
|
+
* - `header` — sender name and time (the name label in `bubbles`)
|
|
113
|
+
* - `body` — the text (or "Message deleted")
|
|
114
|
+
* - `attachments` — images and files
|
|
115
|
+
* - `reactions` — the reaction pills
|
|
116
|
+
* - `thread` — the "N replies" link
|
|
117
|
+
* - `actions` — the long-press actions sheet
|
|
118
|
+
*/
|
|
119
|
+
interface MessageSlots {
|
|
120
|
+
header?: MessageSlot;
|
|
121
|
+
body?: MessageSlot;
|
|
122
|
+
attachments?: MessageSlot;
|
|
123
|
+
reactions?: MessageSlot;
|
|
124
|
+
thread?: MessageSlot;
|
|
125
|
+
actions?: MessageSlot;
|
|
126
|
+
}
|
|
127
|
+
type MessageSlotContext = Omit<MessageSlotProps, 'children'>;
|
|
128
|
+
/** Third argument to `renderMessage`. */
|
|
129
|
+
interface RenderMessageContext {
|
|
130
|
+
layout: ChatLayout;
|
|
131
|
+
groupPosition: GroupPosition;
|
|
132
|
+
isRunStart: boolean;
|
|
133
|
+
/** The row ConversationView would have rendered for this message. */
|
|
134
|
+
renderDefault: () => ReactElement;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
type BubbleGroupPosition = 'first' | 'middle' | 'last' | 'standalone';
|
|
138
|
+
interface MessageBubbleProps {
|
|
139
|
+
message: Message;
|
|
140
|
+
/** Used to decide left/right alignment, color, and read-receipt visibility. */
|
|
141
|
+
currentUserId: string | null;
|
|
142
|
+
/** `'sent'` → single tick, `'read'` → double tick (theme.colors.accent). */
|
|
143
|
+
readState?: 'sent' | 'read';
|
|
144
|
+
/** Label resolver keyed by `external_id` — falls back to the externalId itself. */
|
|
145
|
+
labelFor?: (externalId: string) => string;
|
|
146
|
+
/** Quoted-card tap handler. Typically used to scroll the list to the original message. */
|
|
147
|
+
onQuotedClick?: (quotedMessageId: Uuid) => void;
|
|
148
|
+
/** Position in a same-sender cluster — drives tail-corner rendering. */
|
|
149
|
+
groupPosition?: BubbleGroupPosition;
|
|
150
|
+
/** Truncate at this many chars and show a "Read more" toggle. Defaults to 0 (off). */
|
|
151
|
+
maxBodyLength?: number;
|
|
152
|
+
/** Show a colored sender label above other-side bubbles. Only meaningful in group chats. */
|
|
153
|
+
showSenderName?: boolean;
|
|
154
|
+
/** Makes the sender label (see `showSenderName`) tappable. */
|
|
155
|
+
onSenderPress?: () => void;
|
|
156
|
+
/** Slot for an actions trigger — typically a chevron rendered by `<MessageRow>`. */
|
|
157
|
+
actionsTrigger?: ReactNode;
|
|
158
|
+
/**
|
|
159
|
+
* Long-press, forwarded into the image tiles. The tiles are
|
|
160
|
+
* Pressables of their own and win the gesture, so a wrapper's
|
|
161
|
+
* onLongPress never fires over an image-only message without this.
|
|
162
|
+
*/
|
|
163
|
+
onLongPress?: () => void;
|
|
164
|
+
/** Render in-bubble attachments (images, file cards). Defaults to true. */
|
|
165
|
+
showAttachments?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Render the body as Markdown (bold, italic, code, lists, links).
|
|
168
|
+
* Links open via `Linking.openURL`. Requires
|
|
169
|
+
* `react-native-markdown-display` to be installed in the host app;
|
|
170
|
+
* without it we fall back to plain text. Defaults to true.
|
|
171
|
+
*/
|
|
172
|
+
markdown?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* `'12h'` / `'24h'` for the time of day, or a formatter that returns
|
|
175
|
+
* the whole label. Defaults to the locale's.
|
|
176
|
+
*/
|
|
177
|
+
timeFormat?: TimeFormat;
|
|
178
|
+
/** `'compact'` tightens the text padding. Defaults to `'comfortable'`. */
|
|
179
|
+
density?: ChatDensity;
|
|
180
|
+
/**
|
|
181
|
+
* Replace or wrap the `header` (sender label), `attachments` and
|
|
182
|
+
* `body` parts. Needs `slotContext` (MessageRow passes both).
|
|
183
|
+
*/
|
|
184
|
+
slots?: MessageSlots;
|
|
185
|
+
slotContext?: MessageSlotContext;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* One message bubble, structured as stacked sections rather than one
|
|
189
|
+
* padded box: media bleeds to a 3px frame, text carries its own
|
|
190
|
+
* padding, and the timestamp shares the last text line when measured
|
|
191
|
+
* room allows — which is what makes "ok" a one-line bubble instead of
|
|
192
|
+
* a squat rectangle.
|
|
193
|
+
*/
|
|
194
|
+
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, onSenderPress, actionsTrigger, showAttachments, markdown, onLongPress, timeFormat, density, slots, slotContext, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
195
|
+
|
|
196
|
+
/** Who sent a message — what `onSenderPress` / `onAvatarPress` receive. */
|
|
197
|
+
interface MessageUser {
|
|
198
|
+
/** poolse user id. */
|
|
199
|
+
userId: Uuid | null;
|
|
200
|
+
/** Your own user id (`external_id`) — what `userResolver` takes. */
|
|
201
|
+
externalId: string | null;
|
|
202
|
+
/** Resolved name, or the fallback shown in its place. */
|
|
203
|
+
displayName: string;
|
|
204
|
+
avatarUrl: string | null;
|
|
205
|
+
}
|
|
206
|
+
interface MessageRowProps {
|
|
207
|
+
msg: Message;
|
|
208
|
+
meId: string | null;
|
|
209
|
+
reactions?: boolean;
|
|
210
|
+
attachments?: boolean;
|
|
211
|
+
actions?: boolean;
|
|
212
|
+
/** Pass false in ThreadView since nested threads aren't a thing in v1. */
|
|
213
|
+
threads?: boolean;
|
|
214
|
+
/** WhatsApp-style quote-reply. Defaults true on ConversationView. */
|
|
215
|
+
quotations?: boolean;
|
|
216
|
+
/** Forwarded to `<MessageBubble markdown>`. Defaults true. */
|
|
217
|
+
markdown?: boolean;
|
|
218
|
+
readState?: 'sent' | 'read';
|
|
219
|
+
/**
|
|
220
|
+
* Whether this row's message is the one currently being edited.
|
|
221
|
+
* Editing happens in the composer (see MessageComposer's
|
|
222
|
+
* `editingMessage` prop); this flag is only used to elevate the
|
|
223
|
+
* row above the dim backdrop ConversationView renders during
|
|
224
|
+
* edit mode.
|
|
225
|
+
*/
|
|
226
|
+
isEditing?: boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Long-press → "Edit". Omitted entirely (no Edit option in the
|
|
229
|
+
* menu) when the parent has decided this message isn't editable
|
|
230
|
+
* (someone read it, it's deleted, it isn't yours).
|
|
231
|
+
*/
|
|
232
|
+
onStartEdit?: () => void;
|
|
233
|
+
onDelete?: () => void;
|
|
234
|
+
onOpenThread?: () => void;
|
|
235
|
+
onQuote?: () => void;
|
|
236
|
+
labelFor?: (externalId: string) => string;
|
|
237
|
+
onQuotedClick?: (quotedMessageId: Uuid) => void;
|
|
238
|
+
groupPosition?: BubbleGroupPosition;
|
|
239
|
+
maxBodyLength?: number;
|
|
240
|
+
/** Show a colored sender label above other-side bubbles. */
|
|
241
|
+
showSenderName?: boolean;
|
|
242
|
+
/** Render an avatar to the LEFT of other-side bubbles. */
|
|
243
|
+
showAvatar?: boolean;
|
|
244
|
+
/** Avatar resolver — same signature as `<MemberList avatarFor>`. */
|
|
245
|
+
avatarFor?: (externalId: string) => string | null;
|
|
246
|
+
/** Makes the sender label tappable (other people's messages). */
|
|
247
|
+
onSenderPress?: (user: MessageUser) => void;
|
|
248
|
+
/** Makes the avatar tappable (other people's messages). */
|
|
249
|
+
onAvatarPress?: (user: MessageUser) => void;
|
|
250
|
+
/** Call-log rows: offer "Call back" (see `<CallLogRow onCallBack>`). */
|
|
251
|
+
onCallBack?: (media: 'audio' | 'video') => void;
|
|
252
|
+
/** `'bubbles'` (default), `'list'` or `'compact'` — see `ChatLayout`. */
|
|
253
|
+
layout?: ChatLayout;
|
|
254
|
+
/** `'comfortable'` (default) or `'compact'` spacing. */
|
|
255
|
+
density?: ChatDensity;
|
|
256
|
+
/** `'12h'`, `'24h'` or a formatter for timestamps. Defaults to the locale's. */
|
|
257
|
+
timeFormat?: TimeFormat;
|
|
258
|
+
/** Replace or wrap parts of the row — see `MessageSlots`. */
|
|
259
|
+
slots?: MessageSlots;
|
|
260
|
+
/**
|
|
261
|
+
* The message @-mentions the viewer: `list` and `compact` mark it
|
|
262
|
+
* with an accent bar.
|
|
263
|
+
*/
|
|
264
|
+
mentionsMe?: boolean;
|
|
265
|
+
}
|
|
266
|
+
declare function MessageRow(props: MessageRowProps): react_jsx_runtime.JSX.Element | null;
|
|
267
|
+
|
|
79
268
|
interface ConversationViewProps {
|
|
80
269
|
conversationId: Uuid;
|
|
81
270
|
emptyState?: ReactElement | string;
|
|
82
271
|
/**
|
|
83
272
|
* Custom row renderer. Return `null` / `undefined` to fall back to
|
|
84
273
|
* the default row for that message (so you can override just the
|
|
85
|
-
* message kinds you care about).
|
|
274
|
+
* message kinds you care about). The third argument carries the
|
|
275
|
+
* layout and `renderDefault()`, the row this view would have drawn.
|
|
276
|
+
*/
|
|
277
|
+
renderMessage?: (msg: Message, currentUserId: string | null, context: RenderMessageContext) => ReactElement | null | undefined;
|
|
278
|
+
/**
|
|
279
|
+
* How messages are drawn:
|
|
280
|
+
* * `'bubbles'` (default) — chat bubbles, yours on the right.
|
|
281
|
+
* * `'list'` — Slack-style full-width rows; avatar, name and time
|
|
282
|
+
* once per run, later messages' time dimmed in the gutter,
|
|
283
|
+
* "N replies" under threads. Long-press for actions.
|
|
284
|
+
* * `'compact'` — Discord/IRC-style dense lines: time, the name in
|
|
285
|
+
* the sender's colour, the text; an accent bar on messages that
|
|
286
|
+
* mention you.
|
|
287
|
+
*/
|
|
288
|
+
layout?: ChatLayout;
|
|
289
|
+
/** `'comfortable'` (default) or `'compact'` spacing, in any layout. */
|
|
290
|
+
density?: ChatDensity;
|
|
291
|
+
/**
|
|
292
|
+
* Show avatars. Defaults: `list` on, `compact` off, `bubbles` per
|
|
293
|
+
* `avatars` (others' messages in group chats). Overrides `avatars`.
|
|
294
|
+
*/
|
|
295
|
+
showAvatars?: boolean;
|
|
296
|
+
/** `'12h'`, `'24h'` or a formatter. Defaults to the locale's. */
|
|
297
|
+
timeFormat?: TimeFormat;
|
|
298
|
+
/**
|
|
299
|
+
* Same-sender messages less than this many minutes apart form one
|
|
300
|
+
* run (one bubble cluster, one `list` header). Default 5.
|
|
301
|
+
*/
|
|
302
|
+
groupWindowMinutes?: number;
|
|
303
|
+
/** Day dividers between messages on different days. Defaults to `true`. */
|
|
304
|
+
daySeparators?: boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Replace or wrap one part of every message — `header`, `body`,
|
|
307
|
+
* `attachments`, `reactions`, `thread`, `actions` — in any layout.
|
|
308
|
+
* Each receives the message, sender, layout and its default
|
|
309
|
+
* rendering as `children`.
|
|
86
310
|
*/
|
|
87
|
-
|
|
311
|
+
slots?: MessageSlots;
|
|
88
312
|
labelFor?: (externalId: string) => string;
|
|
89
313
|
avatarFor?: (externalId: string) => string | null;
|
|
90
314
|
/**
|
|
@@ -104,6 +328,10 @@ interface ConversationViewProps {
|
|
|
104
328
|
actions?: boolean;
|
|
105
329
|
threads?: boolean;
|
|
106
330
|
quotations?: boolean;
|
|
331
|
+
/**
|
|
332
|
+
* Show read ticks on your own messages. Only the ticks: the view
|
|
333
|
+
* marks messages read either way, so unread counts stay right.
|
|
334
|
+
*/
|
|
107
335
|
readReceipts?: boolean;
|
|
108
336
|
/** Render message bodies as Markdown (links, bold, code). Defaults true. */
|
|
109
337
|
markdown?: boolean;
|
|
@@ -113,22 +341,41 @@ interface ConversationViewProps {
|
|
|
113
341
|
/** Show avatars to the left of other-side bubbles in group chats. Same semantics. */
|
|
114
342
|
avatars?: 'auto' | 'always' | 'never';
|
|
115
343
|
/**
|
|
116
|
-
* Fires
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
344
|
+
* Fires once the server accepts a new read position (the view marks
|
|
345
|
+
* the newest message read as it arrives). Receives the conversation
|
|
346
|
+
* id + the message id marked as last-read. Every
|
|
347
|
+
* `useConversations()` under the same provider has already cleared
|
|
348
|
+
* the conversation's badge by then.
|
|
121
349
|
*/
|
|
122
350
|
onMarkedRead?: (conversationId: string, messageId: string) => void;
|
|
123
351
|
/**
|
|
124
|
-
* Fires after every successful message send.
|
|
125
|
-
* `useConversations()
|
|
126
|
-
* the
|
|
127
|
-
* conversation you just sent into. `useConversations` creates
|
|
128
|
-
* isolated state per call site, so ConversationView can't refresh
|
|
129
|
-
* a parent hook's state on its own.
|
|
352
|
+
* Fires after every successful message send — e.g. to refetch
|
|
353
|
+
* conversations from a list that isn't `useConversations()` (which
|
|
354
|
+
* gets the new preview over realtime already).
|
|
130
355
|
*/
|
|
131
356
|
onSent?: (conversationId: string) => void;
|
|
357
|
+
/**
|
|
358
|
+
* Jump to this message: older pages load until it's there, then it
|
|
359
|
+
* scrolls into view and is highlighted briefly. Set it again (or to
|
|
360
|
+
* another id) to jump again. When it can't be found — deleted, a
|
|
361
|
+
* thread reply, or not in this conversation — a short notice shows
|
|
362
|
+
* and `onFocusMessageNotFound` fires.
|
|
363
|
+
*/
|
|
364
|
+
focusMessageId?: Uuid | null;
|
|
365
|
+
/** `focusMessageId` couldn't be found in this conversation. */
|
|
366
|
+
onFocusMessageNotFound?: (messageId: Uuid) => void;
|
|
367
|
+
/** Makes the sender label on other people's messages tappable. */
|
|
368
|
+
onSenderPress?: (user: MessageUser) => void;
|
|
369
|
+
/** Makes the avatar next to other people's messages tappable. */
|
|
370
|
+
onAvatarPress?: (user: MessageUser) => void;
|
|
371
|
+
/**
|
|
372
|
+
* `false` hides the composer (and with it quote-reply and the
|
|
373
|
+
* attachment picker) — for an archived conversation or a viewer who
|
|
374
|
+
* can't post. Defaults to `true`.
|
|
375
|
+
*/
|
|
376
|
+
composer?: boolean;
|
|
377
|
+
/** Same as `composer={false}`. */
|
|
378
|
+
readOnly?: boolean;
|
|
132
379
|
/**
|
|
133
380
|
* keyboardVerticalOffset passed to the internal KeyboardAvoidingView.
|
|
134
381
|
* On iOS this MUST equal the distance from the screen top to the
|
|
@@ -155,7 +402,7 @@ interface ConversationViewProps {
|
|
|
155
402
|
*/
|
|
156
403
|
currentCallId?: string | null;
|
|
157
404
|
}
|
|
158
|
-
declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, avatarFor, header, onHeaderMembersPress, onHeaderPress, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, senderLabels, avatars, onMarkedRead, onSent, keyboardOffset, onCallBack, onJoinCall, currentCallId, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
405
|
+
declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, avatarFor, header, onHeaderMembersPress, onHeaderPress, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, senderLabels, avatars, onMarkedRead, onSent, focusMessageId, onFocusMessageNotFound, onSenderPress, onAvatarPress, composer, readOnly, keyboardOffset, onCallBack, onJoinCall, currentCallId, layout, density, showAvatars: showAvatarsProp, timeFormat, groupWindowMinutes, daySeparators, slots, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
159
406
|
|
|
160
407
|
interface ChatHeaderProps {
|
|
161
408
|
conversationId: Uuid;
|
|
@@ -225,95 +472,6 @@ interface GroupDetailsSheetProps {
|
|
|
225
472
|
*/
|
|
226
473
|
declare function GroupDetailsSheet({ visible, onClose, conversationId, labelFor, avatarFor, canRemoveMember, }: GroupDetailsSheetProps): react_jsx_runtime.JSX.Element;
|
|
227
474
|
|
|
228
|
-
type BubbleGroupPosition = 'first' | 'middle' | 'last' | 'standalone';
|
|
229
|
-
interface MessageBubbleProps {
|
|
230
|
-
message: Message;
|
|
231
|
-
/** Used to decide left/right alignment, color, and read-receipt visibility. */
|
|
232
|
-
currentUserId: string | null;
|
|
233
|
-
/** `'sent'` → single tick, `'read'` → double tick (theme.colors.brand). */
|
|
234
|
-
readState?: 'sent' | 'read';
|
|
235
|
-
/** Label resolver keyed by `external_id` — falls back to the externalId itself. */
|
|
236
|
-
labelFor?: (externalId: string) => string;
|
|
237
|
-
/** Quoted-card tap handler. Typically used to scroll the list to the original message. */
|
|
238
|
-
onQuotedClick?: (quotedMessageId: Uuid) => void;
|
|
239
|
-
/** Position in a same-sender cluster — drives tail-corner rendering. */
|
|
240
|
-
groupPosition?: BubbleGroupPosition;
|
|
241
|
-
/** Truncate at this many chars and show a "Read more" toggle. Defaults to 0 (off). */
|
|
242
|
-
maxBodyLength?: number;
|
|
243
|
-
/** Show a colored sender label above other-side bubbles. Only meaningful in group chats. */
|
|
244
|
-
showSenderName?: boolean;
|
|
245
|
-
/** Slot for an actions trigger — typically a chevron rendered by `<MessageRow>`. */
|
|
246
|
-
actionsTrigger?: ReactNode;
|
|
247
|
-
/**
|
|
248
|
-
* Long-press, forwarded into the image tiles. The tiles are
|
|
249
|
-
* Pressables of their own and win the gesture, so a wrapper's
|
|
250
|
-
* onLongPress never fires over an image-only message without this.
|
|
251
|
-
*/
|
|
252
|
-
onLongPress?: () => void;
|
|
253
|
-
/** Render in-bubble attachments (images, file cards). Defaults to true. */
|
|
254
|
-
showAttachments?: boolean;
|
|
255
|
-
/**
|
|
256
|
-
* Render the body as Markdown (bold, italic, code, lists, links).
|
|
257
|
-
* Links open via `Linking.openURL`. Requires
|
|
258
|
-
* `react-native-markdown-display` to be installed in the host app;
|
|
259
|
-
* without it we fall back to plain text. Defaults to true.
|
|
260
|
-
*/
|
|
261
|
-
markdown?: boolean;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* One message bubble, structured as stacked sections rather than one
|
|
265
|
-
* padded box: media bleeds to a 3px frame, text carries its own
|
|
266
|
-
* padding, and the timestamp shares the last text line when measured
|
|
267
|
-
* room allows — which is what makes "ok" a one-line bubble instead of
|
|
268
|
-
* a squat rectangle.
|
|
269
|
-
*/
|
|
270
|
-
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, actionsTrigger, showAttachments, markdown, onLongPress, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
271
|
-
|
|
272
|
-
interface MessageRowProps {
|
|
273
|
-
msg: Message;
|
|
274
|
-
meId: string | null;
|
|
275
|
-
reactions?: boolean;
|
|
276
|
-
attachments?: boolean;
|
|
277
|
-
actions?: boolean;
|
|
278
|
-
/** Pass false in ThreadView since nested threads aren't a thing in v1. */
|
|
279
|
-
threads?: boolean;
|
|
280
|
-
/** WhatsApp-style quote-reply. Defaults true on ConversationView. */
|
|
281
|
-
quotations?: boolean;
|
|
282
|
-
/** Forwarded to `<MessageBubble markdown>`. Defaults true. */
|
|
283
|
-
markdown?: boolean;
|
|
284
|
-
readState?: 'sent' | 'read';
|
|
285
|
-
/**
|
|
286
|
-
* Whether this row's message is the one currently being edited.
|
|
287
|
-
* Editing happens in the composer (see MessageComposer's
|
|
288
|
-
* `editingMessage` prop); this flag is only used to elevate the
|
|
289
|
-
* row above the dim backdrop ConversationView renders during
|
|
290
|
-
* edit mode.
|
|
291
|
-
*/
|
|
292
|
-
isEditing?: boolean;
|
|
293
|
-
/**
|
|
294
|
-
* Long-press → "Edit". Omitted entirely (no Edit option in the
|
|
295
|
-
* menu) when the parent has decided this message isn't editable
|
|
296
|
-
* (someone read it, it's deleted, it isn't yours).
|
|
297
|
-
*/
|
|
298
|
-
onStartEdit?: () => void;
|
|
299
|
-
onDelete?: () => void;
|
|
300
|
-
onOpenThread?: () => void;
|
|
301
|
-
onQuote?: () => void;
|
|
302
|
-
labelFor?: (externalId: string) => string;
|
|
303
|
-
onQuotedClick?: (quotedMessageId: Uuid) => void;
|
|
304
|
-
groupPosition?: BubbleGroupPosition;
|
|
305
|
-
maxBodyLength?: number;
|
|
306
|
-
/** Show a colored sender label above other-side bubbles. */
|
|
307
|
-
showSenderName?: boolean;
|
|
308
|
-
/** Render an avatar to the LEFT of other-side bubbles. */
|
|
309
|
-
showAvatar?: boolean;
|
|
310
|
-
/** Avatar resolver — same signature as `<MemberList avatarFor>`. */
|
|
311
|
-
avatarFor?: (externalId: string) => string | null;
|
|
312
|
-
/** Call-log rows: offer "Call back" (see `<CallLogRow onCallBack>`). */
|
|
313
|
-
onCallBack?: (media: 'audio' | 'video') => void;
|
|
314
|
-
}
|
|
315
|
-
declare function MessageRow(props: MessageRowProps): react_jsx_runtime.JSX.Element | null;
|
|
316
|
-
|
|
317
475
|
interface CallLogRowProps {
|
|
318
476
|
/** The call-log message. Rows that aren't call logs render nothing. */
|
|
319
477
|
msg: Pick<Message, 'type' | 'body' | 'inserted_at'> & {
|
|
@@ -474,6 +632,13 @@ interface MessageListProps {
|
|
|
474
632
|
* scrolled away from the bottom. Tapping scrolls to the latest.
|
|
475
633
|
*/
|
|
476
634
|
meId?: string | null;
|
|
635
|
+
/**
|
|
636
|
+
* Scroll this message to the middle of the list (it must already be
|
|
637
|
+
* in `messages`). Changing `scrollRequest` — e.g. a counter — scrolls
|
|
638
|
+
* again to the same message.
|
|
639
|
+
*/
|
|
640
|
+
scrollToMessageId?: string | null;
|
|
641
|
+
scrollRequest?: number;
|
|
477
642
|
}
|
|
478
643
|
/**
|
|
479
644
|
* Inverted FlatList wrapper for chat history. Newest message at the
|
|
@@ -483,10 +648,16 @@ interface MessageListProps {
|
|
|
483
648
|
* Pagination is owned by `useMessages` (hand it `messages` +
|
|
484
649
|
* `hasMore` + `loadMore`); this component just renders + scrolls.
|
|
485
650
|
*/
|
|
486
|
-
declare function MessageList({ messages, items, loading, hasMore, onLoadMore, renderItem, ListHeader, ListFooter, emptyState, meId, }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
651
|
+
declare function MessageList({ messages, items, loading, hasMore, onLoadMore, renderItem, ListHeader, ListFooter, emptyState, meId, scrollToMessageId, scrollRequest, }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
487
652
|
|
|
488
653
|
interface DaySeparatorProps {
|
|
489
654
|
label: string;
|
|
655
|
+
/**
|
|
656
|
+
* `'pill'` (default) — a centred chip, for bubbles. `'rule'` — a
|
|
657
|
+
* hairline across the row with the chip on it, for the `list` and
|
|
658
|
+
* `compact` layouts.
|
|
659
|
+
*/
|
|
660
|
+
variant?: 'pill' | 'rule';
|
|
490
661
|
}
|
|
491
662
|
/**
|
|
492
663
|
* Centered date pill rendered between messages whose `inserted_at`
|
|
@@ -494,7 +665,7 @@ interface DaySeparatorProps {
|
|
|
494
665
|
* with `formatDayLabel` from `@poolse/react` to compute the label
|
|
495
666
|
* ("Today" / "Yesterday" / weekday / "26 May 2024").
|
|
496
667
|
*/
|
|
497
|
-
declare function DaySeparator({ label }: DaySeparatorProps): react_jsx_runtime.JSX.Element;
|
|
668
|
+
declare function DaySeparator({ label, variant }: DaySeparatorProps): react_jsx_runtime.JSX.Element;
|
|
498
669
|
|
|
499
670
|
interface TypingIndicatorProps {
|
|
500
671
|
/** Set of `external_id`s currently typing — what `useTyping` returns. */
|
|
@@ -519,6 +690,9 @@ interface ThreadViewProps {
|
|
|
519
690
|
rootMessage: Message;
|
|
520
691
|
labelFor?: (externalId: string) => string;
|
|
521
692
|
avatarFor?: (externalId: string) => string | null;
|
|
693
|
+
/** Row layout for the root and replies — see `ChatLayout`. Defaults to `'bubbles'`. */
|
|
694
|
+
layout?: ChatLayout;
|
|
695
|
+
timeFormat?: TimeFormat;
|
|
522
696
|
}
|
|
523
697
|
/**
|
|
524
698
|
* Bottom-sheet modal for thread replies. Pull the drag handle / header
|
|
@@ -535,7 +709,7 @@ interface ThreadViewProps {
|
|
|
535
709
|
* sheet top (the gutter), since KAV measures its frame relative to
|
|
536
710
|
* its parent (the sheet), not the screen.
|
|
537
711
|
*/
|
|
538
|
-
declare function ThreadView({ visible, onClose, conversationId, rootMessage, labelFor, avatarFor, }: ThreadViewProps): react_jsx_runtime.JSX.Element;
|
|
712
|
+
declare function ThreadView({ visible, onClose, conversationId, rootMessage, labelFor, avatarFor, layout, timeFormat, }: ThreadViewProps): react_jsx_runtime.JSX.Element;
|
|
539
713
|
|
|
540
714
|
interface UserNameProps {
|
|
541
715
|
/** The user's external_id. Pass null to render the fallback. */
|
|
@@ -1027,8 +1201,8 @@ interface AvatarProps {
|
|
|
1027
1201
|
seed?: string | null;
|
|
1028
1202
|
/** Show a green presence dot in the bottom-right corner. */
|
|
1029
1203
|
online?: boolean;
|
|
1030
|
-
/** Size variant. `md` → 40px, `sm` → 28px, `lg` → 56px. */
|
|
1031
|
-
size?: 'sm' | 'md' | 'lg';
|
|
1204
|
+
/** Size variant. `md` → 40px, `sm` → 28px, `xs` → 20px, `lg` → 56px. */
|
|
1205
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
1032
1206
|
}
|
|
1033
1207
|
declare function Avatar({ src, name, seed, online, size }: AvatarProps): react_jsx_runtime.JSX.Element;
|
|
1034
1208
|
|
|
@@ -1123,26 +1297,42 @@ type PoolseRNThemeOverrides = {
|
|
|
1123
1297
|
|
|
1124
1298
|
interface PoolseThemeProps {
|
|
1125
1299
|
/**
|
|
1126
|
-
*
|
|
1127
|
-
*
|
|
1300
|
+
* A built-in theme's id (`'coral'`, `'ocean'`, `'forest'`, `'grape'`,
|
|
1301
|
+
* `'slate'`, `'sunset'`, `'rose'`, `'mono'`) or a whole `Theme` from
|
|
1302
|
+
* `@poolse/theme` (`createTheme`, `decodeTheme`).
|
|
1303
|
+
*
|
|
1304
|
+
* Still accepted, deprecated: a partial legacy override such as
|
|
1305
|
+
* `{ colors: { brand: '#000' } }`, deep-merged over the default
|
|
1306
|
+
* palette as before.
|
|
1307
|
+
*/
|
|
1308
|
+
theme?: ThemeInput | PoolseRNThemeOverrides;
|
|
1309
|
+
/**
|
|
1310
|
+
* `'light'`, `'dark'`, or `'system'` to follow the OS (live). Defaults
|
|
1311
|
+
* to `'system'` when `theme` is a built-in id or a `Theme`; otherwise
|
|
1312
|
+
* to `mode`, then `'light'`, as before.
|
|
1128
1313
|
*/
|
|
1314
|
+
colorScheme?: ColorSchemePreference;
|
|
1315
|
+
/** @deprecated Use `colorScheme`. */
|
|
1129
1316
|
mode?: ThemeMode;
|
|
1130
1317
|
/**
|
|
1131
|
-
*
|
|
1132
|
-
*
|
|
1133
|
-
*
|
|
1134
|
-
* color from the base theme.
|
|
1318
|
+
* Font families for a `theme` (React Native can't use the web font
|
|
1319
|
+
* stacks). Defaults to the platform fonts; pass the names you loaded
|
|
1320
|
+
* with expo-font.
|
|
1135
1321
|
*/
|
|
1136
|
-
|
|
1322
|
+
fonts?: NativeThemeOptions['fonts'];
|
|
1137
1323
|
children: ReactNode;
|
|
1138
1324
|
}
|
|
1139
|
-
declare function PoolseTheme({ mode, theme, children }: PoolseThemeProps): react_jsx_runtime.JSX.Element;
|
|
1140
1325
|
/**
|
|
1141
|
-
*
|
|
1142
|
-
*
|
|
1143
|
-
|
|
1326
|
+
* Themes everything inside it. Switching `theme` or `colorScheme`
|
|
1327
|
+
* re-renders with the new tokens; nothing remounts.
|
|
1328
|
+
*/
|
|
1329
|
+
declare function PoolseTheme({ theme, colorScheme, mode, fonts, children }: PoolseThemeProps): react_jsx_runtime.JSX.Element;
|
|
1330
|
+
/**
|
|
1331
|
+
* The active theme's tokens (`@poolse/theme` names: `colors.accent`,
|
|
1332
|
+
* `fonts.body`, `radii.bubble`, …) for the active scheme. Without a
|
|
1333
|
+
* `<PoolseTheme>` ancestor: the default light palette.
|
|
1144
1334
|
*/
|
|
1145
|
-
declare function
|
|
1335
|
+
declare function useTheme(): NativeTheme;
|
|
1146
1336
|
|
|
1147
1337
|
declare const defaultLightTheme: PoolseRNTheme;
|
|
1148
1338
|
declare const defaultDarkTheme: PoolseRNTheme;
|
|
@@ -1312,4 +1502,4 @@ declare const callColors: {
|
|
|
1312
1502
|
*/
|
|
1313
1503
|
declare function useCallDuration(connected: boolean): string | null;
|
|
1314
1504
|
|
|
1315
|
-
export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, CallAvatar, type CallAvatarProps, CallControlButton, type CallControlButtonProps, CallLogRow, type CallLogRowProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, type PoolseRNTheme, type PoolseRNThemeOverrides, PoolseTheme, type PoolseThemeProps, primitives as Primitives, ReactionPicker, type ReactionPickerProps, ReactionStrip, type ReactionStripProps, type ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useCallDuration, useDisplayName,
|
|
1505
|
+
export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, CallAvatar, type CallAvatarProps, CallControlButton, type CallControlButtonProps, CallLogRow, type CallLogRowProps, type ChatDensity, ChatHeader, type ChatHeaderProps, type ChatLayout, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, type MessageSlot, type MessageSlotProps, type MessageSlots, type MessageUser, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, type PoolseRNTheme, type PoolseRNThemeOverrides, PoolseTheme, type PoolseThemeProps, primitives as Primitives, ReactionPicker, type ReactionPickerProps, ReactionStrip, type ReactionStripProps, type RenderMessageContext, type ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, type TimeFormat, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useCallDuration, useDisplayName, useTheme };
|