@poolse/react-native 3.4.0 → 3.6.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 CHANGED
@@ -4,6 +4,87 @@ All notable changes to `@poolse/react-native` are documented here.
4
4
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/);
5
5
  versions follow [semver](https://semver.org).
6
6
 
7
+ ## [3.6.0] - 2026-11-21
8
+
9
+ ### Added
10
+
11
+ - Presence: `PresenceBadge` (`state`, `doNotDisturb`, `size`, `ringColor`) —
12
+ online in `success`, away in `warning`, in a call in `accent` with a phone,
13
+ do not disturb as a moon, nothing for offline. `Avatar` takes `presence`
14
+ (a `PresenceState`, or `true` to look it up with `useUserPresence` for
15
+ `userId` / `seed`) and `doNotDisturb`. `ChatHeader` (direct chats) says
16
+ "Online", "Away", "In a call" or "Last seen …" and badges the avatar.
17
+ `showPresence` on `ConversationView` (message avatars, default off),
18
+ `ConversationList`, `MemberList` and `PoolseInbox` (default on).
19
+ - `useAppStatePresence(enabled?)`: `presence.setActivity('active' | 'idle')`
20
+ from `AppState`. `useAppStateLifecycle()` does it too (`{ presence: false }`
21
+ to opt out) and `PoolseInbox` by default (`trackActivity`).
22
+ - `LinkPreviewCard` (`preview`, `onRemove`, `maxWidth`, `tone`,
23
+ `onLongPress`) under the text in every layout; "Remove preview" in the
24
+ sender's long-press sheet (`chat.messages.update(id, { remove_link_previews:
25
+ [url] })`). Props `linkPreviews` on `ConversationView`, `ThreadView`,
26
+ `MessageRow`, `MessageBubble`; `onRemoveLinkPreview` on `MessageRow`.
27
+ - `ThreadSummary`: "N replies · last reply 5m ago" with up to three stacked
28
+ avatars of `thread_participants`; replaces the "N replies" link.
29
+ - "New messages" line (`NewMessagesDivider`) above the first message unread
30
+ when the conversation opened, and a pill that jumps to it, loading older
31
+ pages, while it's off screen (`ConversationView newMessagesDivider`).
32
+ - "Mark unread" on other people's messages (`chat.conversations.one(id)
33
+ .markUnread(messageId)`); auto mark-read pauses until the next send.
34
+ `ConversationView markUnread`, `onMarkedUnread`; `MessageRow onMarkUnread`;
35
+ `MessageActions onMarkUnread`.
36
+ - Drafts per conversation (text and quote target) in memory across switches,
37
+ persisted with `ConversationView draftStorage` (`DraftStorage`: `get`,
38
+ `set`, `remove`; async allowed) unless `persistDrafts={false}`; cleared on
39
+ send. Types `DraftStorage`, `ConversationDraft`.
40
+ - `EmojiPicker` (`visible`, `onClose`, `onPick`, `keepOpen`, `title`): a
41
+ built-in sheet with search, recently used and categories. Opened from the
42
+ composer's emoji button (`emojiPicker` on `ConversationView` /
43
+ `MessageComposer`), from "+" in the long-press reactions
44
+ (`MessageActions onMoreReactions`) and after reaction chips
45
+ (`ReactionStrip onMorePress`).
46
+ - `EditHistorySheet` (`messageId`, `currentBody`, `onForbidden`): tap
47
+ "edited" for earlier versions (`chat.messages.edits`); a 403 closes it and
48
+ hides the affordance. `MessageRow editHistory`, `MessageBubble
49
+ onEditedPress`.
50
+ - `ConversationList`: `header`, `sections` (`ConversationSection`:
51
+ `{ title, filter }`) or `groupBy="type"` (`ConversationGroupBy`; "Channels"
52
+ then "Direct messages") through a `SectionList`, infinite scroll on
53
+ `useConversations().loadMore` (controlled: `hasMore`, `loadingMore`,
54
+ `onLoadMore`), `density`, a relative time per row. `PoolseInbox` pages its
55
+ list.
56
+ - Attachments: `maxFileSize` and `acceptedFileTypes` on `ConversationView`
57
+ (`maxFileSize`, `acceptedTypes`, `onError`, `multiple` on
58
+ `AttachmentPicker`); refused files and a denied camera show a notice.
59
+ Several photos can be picked at once.
60
+ - `MessageComposer`: `value` / `onChangeText` (controlled), `onSelectionChange`,
61
+ `accessory`, `emojiPicker`; `MessageComposerHandle.setSelection`, and the
62
+ handle type is exported. `MessageList onVisibleItemsChange`.
63
+
64
+ ### Changed
65
+
66
+ - A deleted message reads "This message was deleted" and has no actions,
67
+ reactions, quote or swipe-to-reply in any layout; its thread link stays.
68
+ - A failed send keeps the text in the composer and shows why above the list;
69
+ `quoted_message_deleted` reads "The message you replied to was deleted." and
70
+ drops the quote.
71
+ - Editing a message no longer touches the unsent draft.
72
+ - The typing indicator also shows in an empty conversation.
73
+ - `MemberList` badges come from `useUserPresence` (workspace presence) rather
74
+ than who has the conversation open, unless `onlineExternalIds` is passed.
75
+ - The picker's "Photo or video" item is "Photo library" (it only ever picked
76
+ photos).
77
+
78
+ ### Fixed
79
+
80
+ - `MentionInput`: typing `@` never opened the member list and picking a member
81
+ didn't reach the input. Suggestions now appear inline as you type `@name`,
82
+ and `mentions` carries the ids whose `@Name` is still in the text.
83
+
84
+ ## [3.5.0] - 2026-11-21
85
+
86
+ - No changes; released with the other `@poolse/*` packages at 3.5.0.
87
+
7
88
  ## [3.4.0] - 2026-11-21
8
89
 
9
90
  ### Added
package/README.md CHANGED
@@ -75,6 +75,72 @@ highlight it) with `onFocusMessageNotFound`, `onSenderPress` and
75
75
  `readOnly`) to hide the composer. Tapping a quoted message jumps to the
76
76
  original.
77
77
 
78
+ ### Chat features
79
+
80
+ ```tsx
81
+ <ConversationView
82
+ conversationId={id}
83
+ showPresence
84
+ draftStorage={{
85
+ get: (k) => storage.getString(k), // MMKV, AsyncStorage, …
86
+ set: (k, v) => storage.set(k, v),
87
+ remove: (k) => storage.delete(k),
88
+ }}
89
+ maxFileSize={25 * 1024 * 1024}
90
+ acceptedFileTypes={['image/*', 'application/pdf']}
91
+ />
92
+ ```
93
+
94
+ - **Drafts.** Unsent text and the quote target stay with each conversation
95
+ while you switch (in memory, always). With `draftStorage` (`get` / `set` /
96
+ `remove` over strings, sync or async) they are also saved under
97
+ `poolse:draft:<conversationId>` and come back after a restart;
98
+ `persistDrafts={false}` keeps them in memory only. Sending clears them.
99
+ - **New messages.** A "New messages" line sits above the first message that
100
+ was unread when the conversation opened; while it is off screen a pill jumps
101
+ to it, loading older pages as needed. `newMessagesDivider={false}` turns
102
+ both off.
103
+ - **Mark unread.** Long-press someone else's message → "Mark unread"
104
+ (`conversations.one(id).markUnread(messageId)`); the view stops marking
105
+ messages read until you send or reopen it. `markUnread={false}` hides it;
106
+ `onMarkedUnread(conversationId, messageId)` fires after it succeeds.
107
+ - **Link previews.** `message.link_previews` show as `<LinkPreviewCard>`s under
108
+ the text (website: image, site name and favicon, title, description; image
109
+ links inline), and tapping opens the link. The sender can long-press →
110
+ "Remove preview". `linkPreviews={false}` turns them off.
111
+ - **Deleted messages** read "This message was deleted" without actions,
112
+ reactions or quoting; their thread link stays. Quotes of a deleted message
113
+ read "Original message deleted". A send whose quote was deleted meanwhile
114
+ shows "The message you replied to was deleted." and keeps your text.
115
+ - **Threads** show as "3 replies · last reply 5m ago" with the last repliers'
116
+ avatars (`<ThreadSummary>`); tap opens the thread.
117
+ - **Edit history.** Tap "edited" to see earlier versions (`<EditHistorySheet>`,
118
+ `chat.messages.edits`); when the workspace keeps history from you (403) the
119
+ label stops offering it.
120
+ - **Emoji.** A built-in `<EmojiPicker>` (search, recently used, categories; no
121
+ extra dependency) opens from the composer's emoji button
122
+ (`emojiPicker={false}` hides it), from "+" in the long-press reactions and
123
+ after a message's reaction chips.
124
+ - **Mentions.** Type `@` in `<MentionInput>` (the default composer) to get
125
+ matching members above the input; picking one inserts `@Name` and sends
126
+ their id in `mentions`.
127
+ - **Attachments.** Camera, photo library (several at once) and files, with
128
+ previews before sending. `maxFileSize` / `acceptedFileTypes` (MIME types,
129
+ `'image/*'`, or `'.pdf'`) refuse files with a message; so does a denied
130
+ camera permission. Needs `expo-image-picker`, `expo-document-picker` and
131
+ `expo-image-manipulator` (pass `attachments={false}` to leave them out).
132
+ - **Presence.** `showPresence` adds badges to message avatars; the header of a
133
+ direct chat says "Online", "Away", "In a call" or "Last seen 5m ago".
134
+
135
+ ### Presence
136
+
137
+ `<PresenceBadge state doNotDisturb>` draws online (`success`), away
138
+ (`warning`), in a call (`accent` with a phone) or do not disturb (a moon), and
139
+ nothing for offline. `<Avatar presence="online">` takes a state, or
140
+ `presence={true}` to look the user up live with `useUserPresence` (by
141
+ `userId`, else `seed`). `ConversationList`, `PoolseInbox` and `MemberList`
142
+ show badges by default (`showPresence={false}` to hide).
143
+
78
144
  ## `useAppStateLifecycle()`
79
145
 
80
146
  Call it once inside `<PoolseProvider>`. From 3.1 it pauses the socket when
@@ -84,6 +150,28 @@ reload from REST after the reconnect. The iOS `inactive` state doesn't pause
84
150
  anything. (In 3.0 it destroyed every channel instead, which left mounted
85
151
  hooks silent until they remounted.)
86
152
 
153
+ It also reports the device as `active` / `idle` for presence
154
+ (`presence.setActivity`), so others see you as away while the app is in the
155
+ background; `useAppStateLifecycle({ presence: false })` leaves that out.
156
+ `useAppStatePresence()` does only that part, and `<PoolseInbox>` does it by
157
+ default (`trackActivity={false}` to stop).
158
+
159
+ ## `ConversationList`
160
+
161
+ ```tsx
162
+ <ConversationList
163
+ header={<SearchField />}
164
+ groupBy="type" // "Channels", then "Direct messages"
165
+ density="compact"
166
+ onSelect={(c) => open(c.id)}
167
+ />
168
+ ```
169
+
170
+ `sections={[{ title, filter }]}` makes your own sections (a conversation goes
171
+ to the first one that takes it; empty sections are hidden). The list pages
172
+ through `useConversations()` as you scroll; with `conversations` passed in,
173
+ give it `hasMore`, `loadingMore` and `onLoadMore`.
174
+
87
175
  ## Components
88
176
 
89
177
  - Composed: `PoolseInbox` (ref: `open`, `openDirect`, `openGroup`,
@@ -97,8 +185,10 @@ hooks silent until they remounted.)
97
185
  size of the bytes it uploads; a custom `onPickInputs` must set `byteSize`
98
186
  to the size of `body`, because the server refuses a file bigger than
99
187
  declared.
100
- - Lists: `ConversationList`, `MemberList`.
101
- - Reactions: `ReactionStrip`, `ReactionPicker`.
188
+ - Lists: `ConversationList`, `MemberList`, `PresenceBadge`.
189
+ - Message parts: `LinkPreviewCard`, `ThreadSummary`, `NewMessagesDivider`,
190
+ `EditHistorySheet`.
191
+ - Reactions: `ReactionStrip` (`onMorePress`), `ReactionPicker`, `EmojiPicker`.
102
192
  - Identity and brand: `UserName`, `useDisplayName`, `Avatar`, `PoolseIcon`,
103
193
  `PoolseLogo`, `Primitives`.
104
194
  - Call screen: `CallControlButton`, `CallAvatar`, `AudioRouteSheet`,