@poolse/react-native 2.29.0 → 3.1.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,30 @@ 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.1.0] — 2026-10-27
8
+
9
+ ### Fixed
10
+
11
+ - `useAppStateLifecycle` no longer tears down every channel when the app
12
+ goes to the background. It pauses the socket and resumes it on return,
13
+ so mounted hooks keep receiving events; before, they went silent until
14
+ remounted. It now pauses only on `background`, not on iOS `inactive`
15
+ (notification centre, app switcher).
16
+ - `AttachmentPicker` declares the size of the bytes it actually uploads.
17
+ The server now refuses a file bigger than its declared size.
18
+
19
+ ## [3.0.0] — 2026-10-26
20
+
21
+ ### Changed
22
+
23
+ - **License.** From 3.0.0 this package is under the poolse SDK License
24
+ (see `LICENSE`): free to use, including commercially, in apps built on
25
+ poolse; not for use with other backends or to build a competing
26
+ service. Versions before 3.0.0 remain MIT.
27
+ - First stable release; all `@poolse/*` packages move to 3.0.0 together.
28
+ Earlier versions are deprecated. See `MIGRATING.md`.
29
+ - The native call core is now `@poolse/native` (was `@poolse/react-native-calls`).
30
+
7
31
  ## [2.29.0] — 2026-10-22
8
32
 
9
33
  ### Removed
@@ -75,7 +99,7 @@ versions follow [semver](https://semver.org).
75
99
  ### Added
76
100
 
77
101
  - `CallScreen onSpeakerChange` — fires with `(speakerOn,
78
- externalDevice)` whenever the audio route changes. Hosts use it to
102
+ externalDevice)` whenever the audio route changes. Hosts use it to
79
103
  drive the proximity sensor: the screen should only go dark near an
80
104
  ear when the sound is actually at the ear.
81
105
 
package/LICENSE ADDED
@@ -0,0 +1,206 @@
1
+ poolse SDK License
2
+
3
+ Copyright (c) 2026 Torsten Labs DOO. All rights reserved.
4
+
5
+ Version 1.0. Applies to poolse SDK releases from version 3.0.0 onwards.
6
+
7
+
8
+ SUMMARY (NOT PART OF THE LICENSE TERMS)
9
+
10
+ This summary is for convenience only. It is not part of the license and
11
+ has no legal effect. If it differs from the terms below, the terms below
12
+ apply.
13
+
14
+ - You can use, copy and modify the SDK for free, including in
15
+ commercial apps, as long as your app talks to the poolse Services.
16
+ - You can ship the SDK inside your app, compiled or bundled, including
17
+ the native iOS and Android source code needed to build it.
18
+ - You cannot use the SDK with any other backend, use it to build a
19
+ competing chat, realtime, calling or push service, or redistribute
20
+ or sell it as a standalone library or SDK.
21
+ - Keep this license notice in copies of the SDK source.
22
+ - The SDK comes with no warranty.
23
+ - Versions published before 3.0.0 remain under the MIT License.
24
+
25
+
26
+ TERMS AND CONDITIONS
27
+
28
+ 1. Definitions
29
+
30
+ "Licensor" means Torsten Labs DOO, Ilindenska 335, 1200 Tetovo, North
31
+ Macedonia.
32
+
33
+ "You" means the individual or legal entity exercising rights under this
34
+ license. If you accept this license on behalf of an organisation, "you"
35
+ includes that organisation.
36
+
37
+ "SDK" means the software in this package or repository published by the
38
+ Licensor under this license, including source code, compiled code, native
39
+ iOS and Android code, type definitions, configuration plugins, examples
40
+ and documentation, together with any updates the Licensor provides under
41
+ this license.
42
+
43
+ "poolse Services" means the hosted services operated by the Licensor under
44
+ the name "poolse", currently offered at https://poolse.dev, including their
45
+ APIs, realtime, calling and push notification infrastructure. It also
46
+ includes any self-hosted or on-premise deployment of poolse that you have
47
+ licensed directly from the Licensor, for as long as that license is in
48
+ effect.
49
+
50
+ "Application" means a website, mobile app, desktop app, server or other
51
+ software product that you develop and that provides material functionality
52
+ of its own beyond the SDK.
53
+
54
+ "Derivative Work" means any modification of the SDK, and any work that
55
+ contains the SDK or a substantial portion of it.
56
+
57
+ 2. License Grant
58
+
59
+ Subject to the terms of this license, the Licensor grants you a worldwide,
60
+ non-exclusive, non-transferable, royalty-free license to:
61
+
62
+ (a) install, use, copy and modify the SDK, and create Derivative Works,
63
+ solely to develop, test and operate Applications that use the poolse
64
+ Services; and
65
+
66
+ (b) distribute the SDK and your Derivative Works, in source or compiled
67
+ form, only as an integrated part of your Applications. This includes
68
+ bundled or minified JavaScript and the native iOS and Android source
69
+ code that must be included for your Application to be compiled.
70
+
71
+ Your Applications may be commercial, and you may charge for them.
72
+
73
+ 3. Restrictions
74
+
75
+ You may not, and may not allow anyone else to:
76
+
77
+ (a) use the SDK or any Derivative Work with, or adapt it to connect to,
78
+ any backend, API or service other than the poolse Services;
79
+
80
+ (b) use the SDK or any Derivative Work to build, offer or operate a
81
+ product or service that competes with the poolse Services, including
82
+ any chat, messaging, realtime, voice or video calling, or push
83
+ notification service or infrastructure offered to third parties;
84
+
85
+ (c) sell, sublicense, rent, lease or distribute the SDK or any Derivative
86
+ Work on its own, or as a library, SDK, framework, component kit or
87
+ developer tool, rather than as an integrated part of an Application;
88
+
89
+ (d) remove, alter or obscure this license, any copyright notice, or any
90
+ other proprietary notice in the SDK; or
91
+
92
+ (e) use the SDK in violation of applicable law or of the terms of service
93
+ that govern your use of the poolse Services.
94
+
95
+ Nothing in this license grants you any right to use the poolse Services
96
+ themselves. Your use of the poolse Services is governed by your separate
97
+ agreement with the Licensor, including its terms of service.
98
+
99
+ 4. Notices
100
+
101
+ Any copy of the SDK or a Derivative Work in source form, including native
102
+ source code distributed with an Application, must keep this license file
103
+ or a clear reference to it. You do not need to display this license to the
104
+ end users of your Application.
105
+
106
+ 5. Contributions
107
+
108
+ If you submit code, documentation or other material to the Licensor for
109
+ inclusion in the SDK (for example, as a pull request), you grant the
110
+ Licensor a perpetual, worldwide, irrevocable, royalty-free license to use,
111
+ modify, sublicense and distribute that material as part of the SDK or any
112
+ other Licensor product, and you confirm that you have the right to grant
113
+ that license.
114
+
115
+ 6. Ownership
116
+
117
+ The SDK is licensed, not sold. The Licensor and its licensors keep all
118
+ rights, title and interest in the SDK, including all intellectual property
119
+ rights. All rights not expressly granted in this license are reserved. The
120
+ names "poolse" and "Torsten Labs" and their logos are not licensed to you
121
+ except as needed to truthfully describe that your Application uses the
122
+ poolse Services.
123
+
124
+ You own your modifications to the SDK, subject to the Licensor's rights in
125
+ the SDK and to the terms of this license.
126
+
127
+ 7. Feedback
128
+
129
+ If you give the Licensor suggestions or feedback about the SDK, the
130
+ Licensor may use them without any obligation to you.
131
+
132
+ 8. Termination
133
+
134
+ This license ends automatically, without notice, if you breach any of its
135
+ terms. If you cure the breach within 30 days after you become aware of it,
136
+ your license is reinstated, unless the Licensor has notified you in writing
137
+ that it is terminating your license, or you have breached this license
138
+ before.
139
+
140
+ When this license ends, you must stop using and distributing the SDK and
141
+ your Derivative Works, and delete all copies in your possession. Copies of
142
+ Applications already delivered to end users before termination may continue
143
+ to be used by those end users. Sections 3, 5, 6, 7, 9, 10, 11 and 12
144
+ survive termination.
145
+
146
+ 9. Disclaimer of Warranty
147
+
148
+ THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE", WITHOUT WARRANTY OF ANY
149
+ KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE
150
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
151
+ NON-INFRINGEMENT. THE LICENSOR DOES NOT WARRANT THAT THE SDK WILL BE
152
+ ERROR-FREE, SECURE OR UNINTERRUPTED. YOU USE THE SDK AT YOUR OWN RISK.
153
+
154
+ 10. Limitation of Liability
155
+
156
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL THE
157
+ LICENSOR, ITS AFFILIATES OR ITS CONTRIBUTORS BE LIABLE FOR ANY INDIRECT,
158
+ INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY OR PUNITIVE DAMAGES, OR FOR
159
+ ANY LOSS OF PROFITS, REVENUE, DATA, GOODWILL OR BUSINESS OPPORTUNITY,
160
+ ARISING OUT OF OR IN CONNECTION WITH THIS LICENSE OR THE SDK, WHETHER IN
161
+ CONTRACT, TORT (INCLUDING NEGLIGENCE) OR OTHERWISE, EVEN IF ADVISED OF THE
162
+ POSSIBILITY OF SUCH DAMAGES. BECAUSE THE SDK IS PROVIDED FREE OF CHARGE,
163
+ THE LICENSOR'S TOTAL LIABILITY ARISING OUT OF OR IN CONNECTION WITH THIS
164
+ LICENSE OR THE SDK WILL NOT EXCEED ONE HUNDRED EUROS (EUR 100).
165
+
166
+ NOTHING IN THIS LICENSE EXCLUDES OR LIMITS ANY LIABILITY THAT CANNOT BE
167
+ EXCLUDED OR LIMITED UNDER APPLICABLE LAW, INCLUDING LIABILITY FOR WILFUL
168
+ MISCONDUCT OR GROSS NEGLIGENCE.
169
+
170
+ 11. Governing Law and Disputes
171
+
172
+ This license is governed by the laws of the Republic of North Macedonia,
173
+ without regard to its conflict of laws rules. The courts of the Republic of
174
+ North Macedonia have exclusive jurisdiction over any dispute arising out of
175
+ or in connection with this license, except that the Licensor may seek
176
+ injunctive relief to protect its intellectual property in any court of
177
+ competent jurisdiction.
178
+
179
+ 12. General
180
+
181
+ This license is the entire agreement between you and the Licensor about the
182
+ SDK. If any provision is found unenforceable, it will be enforced to the
183
+ maximum extent possible and the remaining provisions stay in effect. A
184
+ failure to enforce a provision is not a waiver. You may not assign this
185
+ license without the Licensor's prior written consent. The Licensor may
186
+ publish new versions of this license; each release of the SDK is governed
187
+ by the version of this license included with it.
188
+
189
+ 13. Earlier Versions
190
+
191
+ Versions of the poolse SDK packages published before version 3.0.0
192
+ (including @poolse/sdk, @poolse/react, @poolse/react-ui and
193
+ @poolse/react-native) were released under the MIT License and remain
194
+ available under the MIT License. This license applies only to versions
195
+ 3.0.0 and later, and to any package first published by the Licensor under
196
+ this license.
197
+
198
+ 14. Contact
199
+
200
+ Questions about this license, or requests for permission beyond it, can be
201
+ sent to legal@poolse.dev.
202
+
203
+ Torsten Labs DOO
204
+ Ilindenska 335
205
+ 1200 Tetovo
206
+ North Macedonia
package/README.md CHANGED
@@ -1,10 +1,15 @@
1
1
  # `@poolse/react-native`
2
2
 
3
- Drop-in React Native chat SDK for Expo and bare React Native. `<ConversationView>` and `<PoolseInbox>` mount a complete chat surface with camera, attachments, markdown, typing indicators, reactions, threads, and AppState lifecycle baked in. Mirrors [`@poolse/react-ui`](https://www.npmjs.com/package/@poolse/react-ui) — same component names, same prop shapes — but implemented against native primitives (`View` / `Text` / `FlatList` / `TextInput` / `Pressable` / `Modal` / `KeyboardAvoidingView`).
3
+ Prebuilt React Native and Expo chat components for
4
+ [poolse](https://poolse.dev): `<PoolseInbox>`, `<ConversationView>` and the
5
+ pieces they are built from, a JS theme, the app-lifecycle hook, and building
6
+ blocks for a call screen. Built on
7
+ [`@poolse/react`](https://www.npmjs.com/package/@poolse/react).
4
8
 
5
- > **MIT-licensed alternative to `sendbird-chat-react-native`, `stream-chat-react-native`, and CometChat React Native UIKit.** Works out of the box with Expo (SDK 50+) and bare React Native (≥ 0.73). JS theme tokens, no native module setup beyond standard peer deps.
9
+ Calls on phones (ringing a locked phone, CallKit, the Android call service)
10
+ are in [`@poolse/native`](https://www.npmjs.com/package/@poolse/native).
6
11
 
7
- Sits on top of [`@poolse/react`](https://www.npmjs.com/package/@poolse/react) (hooks) and [`@poolse/sdk`](https://www.npmjs.com/package/@poolse/sdk) (client).
12
+ Full reference: <https://poolse.dev/docs/sdk/react-native>
8
13
 
9
14
  ## Install
10
15
 
@@ -20,219 +25,98 @@ npx expo install \
20
25
  expo-image-manipulator
21
26
  ```
22
27
 
23
- Use `npx expo install` (not plain `npm install`) so each module is
24
- pinned to a version compatible with your Expo SDK. On bare React
25
- Native without the Expo CLI, swap it for `npm install` and pin
26
- versions yourself.
27
-
28
- **All peer dependencies are required.** The chat surface eagerly
29
- imports each one at module-load time (Metro can't follow `try /
30
- require`, so we don't try — see `2.1.1` release notes). If any peer
31
- is missing the bundle blows up the first time you mount
32
- `<ConversationView>` / `<PoolseInbox>` with "Requiring unknown
33
- module …".
34
-
35
- | Peer | What it powers |
36
- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
37
- | `react-native-svg` | All `<PoolseIcon>` glyphs (send, reply, reactions, chevrons). |
38
- | `react-native-markdown-display` | Bold / italic / code / clickable links inside message bubbles. Disable with `markdown={false}` on `<ConversationView>` if you don't want it — the import still ships in the bundle. |
39
- | `react-native-safe-area-context` | Composer bottom inset when the keyboard is closed, and the `keyboardVerticalOffset` math `<PoolseInbox>` does for its header. Falls back to hardcoded iOS 50/34 constants if missing — usable, but wrong on devices with non-standard insets. |
40
- | `expo-clipboard` | The Copy action in the long-press message menu. |
41
- | `expo-image-picker` | Camera + Photo-library entries in `<AttachmentPicker>`. |
42
- | `expo-document-picker` | File entry in `<AttachmentPicker>`. |
43
- | `expo-image-manipulator` | WebP resize + compress on picked photos before upload (keeps payloads under ~250 KB). |
44
-
45
- **iOS Info.plist** (`app.json` → `ios.infoPlist`):
46
-
47
- ```json
48
- {
49
- "NSCameraUsageDescription": "Take photos to send in chat.",
50
- "NSPhotoLibraryUsageDescription": "Pick photos to send in chat."
51
- }
52
- ```
28
+ Every peer is required: the package imports each one when it loads, so a
29
+ missing one breaks the bundle. Peer ranges: `react` ≥ 18, `react-native` ≥
30
+ 0.73, `react-native-svg` ≥ 14, `react-native-safe-area-context` ≥ 4,
31
+ `react-native-markdown-display` ≥ 7, any `expo-*` version.
53
32
 
54
- Pass `camera={false}` to `<AttachmentPicker>` if you want to skip
55
- the camera entry (and Apple's review burden for `NSCameraUsageDescription`).
33
+ iOS needs `NSCameraUsageDescription` and `NSPhotoLibraryUsageDescription` in
34
+ `ios.infoPlist` for the attachment picker.
56
35
 
57
- **App root** — wrap once with `<SafeAreaProvider>` and `<PoolseProvider>`:
36
+ ## Quick start
58
37
 
59
38
  ```tsx
60
- import { SafeAreaProvider } from 'react-native-safe-area-context';
39
+ import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
61
40
  import { PoolseProvider } from '@poolse/react';
41
+ import { PoolseInbox, PoolseTheme, useAppStateLifecycle } from '@poolse/react-native';
62
42
 
63
43
  export default function App() {
64
44
  return (
65
45
  <SafeAreaProvider>
66
- <PoolseProvider config={{ getToken: ..., apiUrl: ... }}>
67
- <YourScreens />
46
+ <PoolseProvider config={config}>
47
+ <ChatRoot />
68
48
  </PoolseProvider>
69
49
  </SafeAreaProvider>
70
50
  );
71
51
  }
72
- ```
73
-
74
- ## Quick start
75
-
76
- The drop-in inbox — list + detail with a slide animation between them, edge-swipe back, plus built-in pickers when you provide a user directory:
77
-
78
- ```tsx
79
- import { PoolseProvider } from '@poolse/react';
80
- import { PoolseInbox, PoolseTheme } from '@poolse/react-native';
81
-
82
- const users = [
83
- { externalId: 'alice', name: 'Alice', avatarUrl: 'https://…' },
84
- { externalId: 'bob', name: 'Bob', avatarUrl: 'https://…' },
85
- ];
86
-
87
- export default function InboxScreen() {
88
- return (
89
- <PoolseProvider config={{ getToken, userResolver }}>
90
- <PoolseTheme>
91
- <PoolseInbox
92
- title="Chats"
93
- users={users}
94
- labelFor={(externalId) =>
95
- users.find((u) => u.externalId === externalId)?.name ?? externalId
96
- }
97
- avatarFor={(externalId) =>
98
- users.find((u) => u.externalId === externalId)?.avatarUrl ?? null
99
- }
100
- />
101
- </PoolseTheme>
102
- </PoolseProvider>
103
- );
104
- }
105
- ```
106
-
107
- If you'd rather render a single conversation (your app already owns the navigation), use `<ConversationView>` directly:
108
52
 
109
- ```tsx
110
- import { PoolseProvider } from '@poolse/react';
111
- import { PoolseTheme, ConversationView } from '@poolse/react-native';
112
-
113
- export default function ChatScreen({ conversationId }: { conversationId: string }) {
53
+ function ChatRoot() {
54
+ useAppStateLifecycle(); // inside the provider
114
55
  return (
115
- <PoolseProvider config={{ getToken, userResolver }}>
56
+ <SafeAreaView style={{ flex: 1 }}>
116
57
  <PoolseTheme>
117
- <ConversationView conversationId={conversationId} />
58
+ <PoolseInbox title="Chats" users={users} labelFor={labelFor} avatarFor={avatarFor} />
118
59
  </PoolseTheme>
119
- </PoolseProvider>
60
+ </SafeAreaView>
120
61
  );
121
62
  }
122
63
  ```
123
64
 
124
- The same `<PoolseProvider>` you use on web. Wrap it once at the app root if you have multiple chat screens. Drop the `<PoolseTheme>` wrapper if you don't need to override the brand defaults — every component has a fallback theme baked in.
125
-
126
- ## What ships
127
-
128
- | Component | What it does |
129
- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
130
- | `<PoolseInbox>` | Full inbox shell — list + detail with an iOS-style slide animation between them, left-edge-swipe-back to return to the list, built-in `New chat` / `New group` picker sheets when `users` is provided. Imperative ref API: `open`, `openDirect`, `openGroup`, `promptNewChat`, `promptNewGroup`, `close`. |
131
- | `<ChatHeader>` | Title bar — direct chats resolve the other member's name + avatar via `labelFor` / `avatarFor`, groups show member count, presence-driven green dot. Optional `onBack` button. |
132
- | `<ConversationView>` | Composed chat surface — message list + composer + typing strip + thread modal. Single `KeyboardAvoidingView` covers the whole thing so the composer stays above the keyboard on both platforms. |
133
- | `<ThreadView>` | Bottom-sheet modal for thread replies. Reactions + attachments + pull-down-to-close via a 60-pt header drag strip. Composer reuses the same `UploadProvider` queue as the picker. |
134
- | `<GroupDetailsSheet>` | Bottom sheet showing a group's name, avatar, and member roster with presence. Opened from `<ChatHeader>`'s members button. |
135
- | `<MessageBubble>` / `<EditableMessageBubble>` | Single message render — body, meta, read receipt, quoted card, in-bubble attachments. |
136
- | `<MessageRow>` | Bubble + alignment + swipe-to-reply (capture-phase, 1:1 finger follow, sqrt-damped past 50pt threshold). |
137
- | `<MessageList>` | Inverted `FlatList` wrapper — stick-to-bottom, hold-position, auto-load-more. |
138
- | `<MessageComposer>` | Text input with auto-grow, send button, attach button, quote chip. |
139
- | `<MessageActions>` | Long-press menu (reply / quote / edit / delete / copy / react). |
140
- | `<TypingIndicator>` | Animated three-dot indicator + labels. |
141
- | `<ConversationList>` | `FlatList` of conversation rows. Direct rows pull the other member's name + avatar via `labelFor` / `avatarFor`; preview reads `last_message_preview` updated in realtime by the SDK's `conversation:updated` subscription. Unread badges. |
142
- | `<MemberList>` | Member roster with avatars + remove action. |
143
- | `<MentionInput>` | `TextInput` + autocomplete popover. |
144
- | `<ReactionStrip>` / `<ReactionPicker>` | Reaction summary + emoji picker sheet. |
145
- | `<AttachmentPreview>` / `<AttachmentPicker>` | Image or file card. Picker wraps `expo-image-picker` + `expo-document-picker`. |
146
- | `<UploadQueueStrip>` | Pending uploads with cancel. |
147
- | `<UserName>` / `useDisplayName(externalId)` | Display name resolution via the SDK's `userResolver`. |
148
- | `<Avatar>` | Initials + URL fallback, stable color per user. |
149
- | `<PoolseIcon>` / `<PoolseLogo>` | Brand chrome via `react-native-svg`. |
65
+ To show one conversation inside your own navigation, render
66
+ `<ConversationView conversationId={id} keyboardOffset={headerHeight} />`.
67
+
68
+ ## `useAppStateLifecycle()`
69
+
70
+ Call it once inside `<PoolseProvider>`. From 3.1 it pauses the socket when
71
+ the app goes to the background and resumes it when the app becomes active;
72
+ channels and listeners survive, and `useMessages` / `useConversations`
73
+ reload from REST after the reconnect. The iOS `inactive` state doesn't pause
74
+ anything. (In 3.0 it destroyed every channel instead, which left mounted
75
+ hooks silent until they remounted.)
76
+
77
+ ## Components
78
+
79
+ - Composed: `PoolseInbox` (ref: `open`, `openDirect`, `openGroup`,
80
+ `promptNewChat`, `promptNewGroup`, `close`), `ConversationView`,
81
+ `ChatHeader`, `ThreadView` (bottom sheet), `GroupDetailsSheet`.
82
+ - Messages: `MessageList`, `MessageRow`, `MessageBubble`, `MessageActions`
83
+ (long-press sheet), `TypingIndicator`, `DaySeparator`, `CallLogRow`,
84
+ `LiveCallBanner`, `ImageMosaic`.
85
+ - Composer: `MessageComposer`, `MentionInput`, `AttachmentPicker`,
86
+ `UploadQueueStrip`, `AttachmentPreview`. `AttachmentPicker` declares the
87
+ size of the bytes it uploads; a custom `onPickInputs` must set `byteSize`
88
+ to the size of `body`, because the server refuses a file bigger than
89
+ declared.
90
+ - Lists: `ConversationList`, `MemberList`.
91
+ - Reactions: `ReactionStrip`, `ReactionPicker`.
92
+ - Identity and brand: `UserName`, `useDisplayName`, `Avatar`, `PoolseIcon`,
93
+ `PoolseLogo`, `Primitives`.
94
+ - Call screen: `CallControlButton`, `CallAvatar`, `AudioRouteSheet`,
95
+ `callColors`, `useCallDuration`.
96
+
97
+ The names follow `@poolse/react-ui`, but the props differ in places (for
98
+ example `ThreadView` needs `visible` and `onClose`, and there is no
99
+ `EditableMessageBubble`); see the docs for each component's props.
150
100
 
151
101
  ## Theming
152
102
 
153
- JS object via `<PoolseTheme theme={overrides}>`. The full token
154
- surface mirrors the web `--poolse-*` CSS variables, grouped by
155
- purpose:
156
-
157
103
  ```tsx
158
- <PoolseTheme
159
- theme={{
160
- colors: {
161
- brand: '#ff5733',
162
- brandSoft: '#ffe9e3',
163
- onBrand: '#ffffff',
164
- },
165
- radii: {
166
- bubble: 18,
167
- },
168
- }}
169
- >
170
- {/* ... */}
104
+ <PoolseTheme mode="dark" theme={{ colors: { brand: '#ff5733' }, radii: { bubble: 18 } }}>
105
+ {children}
171
106
  </PoolseTheme>
172
107
  ```
173
108
 
174
- Pass nothing to use the brand defaults. Pass `mode="dark"` to swap
175
- to the warm dark palette. Deep-merges your overrides on top —
176
- unspecified tokens keep their default.
177
-
178
- ## Lifecycle
179
-
180
- ```tsx
181
- import { useAppStateLifecycle } from '@poolse/react-native';
182
-
183
- function App() {
184
- useAppStateLifecycle();
185
- return <PoolseProvider config={config}>{/* ... */}</PoolseProvider>;
186
- }
187
- ```
188
-
189
- Closes the SDK WebSocket cleanly when the app backgrounds (iOS /
190
- Android suspend sockets aggressively — keeping them open wastes
191
- battery and produces no benefit). Reopens on foreground and triggers
192
- a tail refetch on the currently-mounted `<ConversationView>` so the
193
- user lands on a fresh state instead of catching up via stale
194
- realtime.
195
-
196
- Pair with push notifications on your backend (subscribe to
197
- `message.created` / `mention.created` webhooks, fan out via APNs /
198
- FCM / Expo's push service) — that's how the user learns about new
199
- messages while the app is closed.
200
-
201
- ## Identity model
202
-
203
- Same SDK 2.0 contract as the web side. All component props that
204
- deal with users are keyed by your `external_id`:
205
-
206
- - `useUser(externalId)`, `useDisplayName(externalId)`
207
- - `<UserName externalId={message.sender_external_id} />`
208
- - `<MemberList labelFor={(externalId) => ...} avatarFor={(externalId) => ...} onlineExternalIds={set} />`
209
- - `<MessageBubble>` / `<MessageComposer>` / `<MentionInput>` / `<TypingIndicator>` — every `labelFor` is `(externalId) => string`.
210
-
211
- The wire still carries `user_id` (the poolse uuid) alongside
212
- `external_id`, but day-to-day app code never has to touch it.
213
-
214
- ## Differences from `@poolse/react-ui`
215
-
216
- | Concern | Web (`react-ui`) | Native (`react-native`) |
217
- | ------------------- | ----------------------------- | -------------------------------------------- |
218
- | Styling | CSS variables in `styles.css` | JS theme via `<PoolseTheme>` |
219
- | Action menu trigger | Hover | Long-press |
220
- | Reaction picker | Inline popover | Modal sheet |
221
- | Mention picker | Inline dropdown | Modal sheet |
222
- | Attachment picker | `<input type=file>` | `expo-image-picker` + `expo-document-picker` |
223
- | Message list | Reversed CSS flexbox | Inverted `FlatList` |
224
- | Markdown | `react-markdown` | Plain text |
225
-
226
- Everything else — feature flags, prop names, callback shapes, hook signatures — is intentionally identical so a web codebase ports across with mostly mechanical changes.
109
+ Overrides merge over the light or dark base theme one group at a time
110
+ (`colors`, `type`, `radii`, `spacing`, `shadows`). `mode` doesn't follow the
111
+ system by itself; pass `useColorScheme()` if you want that. Read the active
112
+ theme with `usePoolseTheme()`.
227
113
 
228
114
  ## Links
229
115
 
230
- - Docs: [poolse.dev/docs/sdk/react-native](https://poolse.dev/docs/sdk/react-native)
231
- - Source: [github.com/poolse-hq/js-sdk](https://github.com/poolse-hq/js-sdk/tree/main/packages/react-native)
232
- - Web sibling: [`@poolse/react-ui`](https://www.npmjs.com/package/@poolse/react-ui)
233
- - Hooks (used internally): [`@poolse/react`](https://www.npmjs.com/package/@poolse/react)
234
- - Core client: [`@poolse/sdk`](https://www.npmjs.com/package/@poolse/sdk)
116
+ - Docs: <https://poolse.dev/docs/sdk/react-native>
117
+ - Source: <https://github.com/poolse-hq/js-sdk>
235
118
 
236
119
  ## License
237
120
 
238
- MIT
121
+ Licensed under the [poolse SDK License](./LICENSE) from 3.0.0; versions
122
+ before 3.0.0 remain MIT.
package/dist/index.cjs CHANGED
@@ -1343,7 +1343,8 @@ async function assetsToInputs(assets) {
1343
1343
  return {
1344
1344
  body: blob,
1345
1345
  contentType,
1346
- byteSize: asset.fileSize ?? blob.size,
1346
+ // The uploaded bytes: the server refuses a file bigger than declared.
1347
+ byteSize: blob.size || asset.fileSize || 0,
1347
1348
  filename: asset.fileName ?? `image-${Date.now()}.jpg`,
1348
1349
  _previewUri: asset.uri
1349
1350
  };
@@ -1406,7 +1407,8 @@ async function defaultAdapter(kind) {
1406
1407
  return {
1407
1408
  body: blob,
1408
1409
  contentType,
1409
- byteSize: asset.size ?? blob.size,
1410
+ // The uploaded bytes: the server refuses a file bigger than declared.
1411
+ byteSize: blob.size || asset.size || 0,
1410
1412
  filename: asset.name,
1411
1413
  _previewUri: asset.uri
1412
1414
  };
@@ -5437,22 +5439,9 @@ var primitives = { PoolseIcon, PoolseLogo, Avatar };
5437
5439
  function useAppStateLifecycle() {
5438
5440
  const poolse = react$1.usePoolse();
5439
5441
  react.useEffect(() => {
5440
- let prev = reactNative.AppState.currentState;
5441
5442
  const sub = reactNative.AppState.addEventListener("change", (next) => {
5442
- const wasActive = prev === "active";
5443
- const isActive = next === "active";
5444
- if (wasActive && !isActive) {
5445
- try {
5446
- poolse.realtime?.disconnect?.();
5447
- } catch {
5448
- }
5449
- } else if (!wasActive && isActive) {
5450
- try {
5451
- poolse.realtime?.connect?.();
5452
- } catch {
5453
- }
5454
- }
5455
- prev = next;
5443
+ if (next === "background") poolse.realtime.pause();
5444
+ else if (next === "active") poolse.realtime.resume();
5456
5445
  });
5457
5446
  return () => sub.remove();
5458
5447
  }, [poolse]);