@poolse/react-native 0.1.1
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 +54 -0
- package/LICENSE +21 -0
- package/README.md +144 -0
- package/dist/index.cjs +2499 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +672 -0
- package/dist/index.d.ts +672 -0
- package/dist/index.js +2470 -0
- package/dist/index.js.map +1 -0
- package/package.json +79 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@poolse/react-native` are documented here.
|
|
4
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/);
|
|
5
|
+
versions follow [semver](https://semver.org).
|
|
6
|
+
|
|
7
|
+
## [0.1.0] — 2026-06-03
|
|
8
|
+
|
|
9
|
+
First release. Plug-and-play React Native UI for poolse, mirroring
|
|
10
|
+
the `@poolse/react-ui` component surface for native targets.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Composed surface**: `<ConversationView>` with feature flags
|
|
15
|
+
(`reactions`, `mentions`, `attachments`, `actions`, `threads`,
|
|
16
|
+
`quotations`, `readReceipts`) — same defaults as web.
|
|
17
|
+
- **Message components**: `<MessageBubble>`, `<EditableMessageBubble>`,
|
|
18
|
+
`<MessageRow>`, `<MessageComposer>`, `<MessageActions>`,
|
|
19
|
+
`<MessageList>` (inverted FlatList with stick-to-bottom +
|
|
20
|
+
hold-position).
|
|
21
|
+
- **Realtime feedback**: `<TypingIndicator>` (animated dots).
|
|
22
|
+
- **Conversation + member panels**: `<ConversationList>` (FlatList +
|
|
23
|
+
unread badges), `<MemberList>`.
|
|
24
|
+
- **Rich content**: `<AttachmentPreview>` (image + file card),
|
|
25
|
+
`<UploadQueueStrip>`, `<ReactionStrip>`, `<ReactionPicker>` (modal
|
|
26
|
+
sheet), `<MentionInput>` (autocomplete popover),
|
|
27
|
+
`<AttachmentPicker>` (wraps `expo-image-picker` and
|
|
28
|
+
`expo-document-picker` when present).
|
|
29
|
+
- **Threads**: `<ThreadView>` (modal screen).
|
|
30
|
+
- **User display**: `<UserName>`, `useDisplayName` — both keyed by
|
|
31
|
+
`externalId` to match SDK 2.0.
|
|
32
|
+
- **Brand chrome**: `<PoolseIcon>` (SVG via `react-native-svg`),
|
|
33
|
+
`<PoolseLogo>` (mark/lockup/wordmark/mono), `<Avatar>` (initials
|
|
34
|
+
- URL fallback + stable userColor hashing).
|
|
35
|
+
- **Theme system**: `<PoolseTheme>` provider + `usePoolseTheme()`
|
|
36
|
+
hook. JS theme object with the same token groups as the web
|
|
37
|
+
`--poolse-*` CSS variables (colors, type, radii, shadows,
|
|
38
|
+
spacing). Light + dark defaults ship in.
|
|
39
|
+
- **AppState lifecycle**: `useAppStateLifecycle()` hook — closes
|
|
40
|
+
the SDK WebSocket on background, reopens + refetches the active
|
|
41
|
+
conversation tail on foreground. Designed to pair with
|
|
42
|
+
push-notification delivery on the dev's backend (no in-app
|
|
43
|
+
background socket maintenance).
|
|
44
|
+
|
|
45
|
+
### Notes
|
|
46
|
+
|
|
47
|
+
- Peer dependencies: `react >=18`, `react-native >=0.73`,
|
|
48
|
+
`react-native-svg >=14`. `expo-image-picker` and
|
|
49
|
+
`expo-document-picker` are optional peer deps — `<AttachmentPicker>`
|
|
50
|
+
only requires them if you mount it.
|
|
51
|
+
- Theming via JS object (no CSS variables). Override any token:
|
|
52
|
+
`<PoolseTheme theme={{ colors: { brand: '#ff5733' } }}>`.
|
|
53
|
+
- Shares the same `<PoolseProvider config={...}>` from
|
|
54
|
+
`@poolse/react` — one provider for both web and RN.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Poolse
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# `@poolse/react-native`
|
|
2
|
+
|
|
3
|
+
Plug-and-play React Native components for [poolse](https://poolse.dev).
|
|
4
|
+
Mirrors [`@poolse/react-ui`](https://www.npmjs.com/package/@poolse/react-ui)
|
|
5
|
+
for native targets: same component names, same prop shapes, same
|
|
6
|
+
feature flags — implemented against `View` / `Text` / `FlatList` /
|
|
7
|
+
`TextInput` / `Pressable` / `Image` / `Modal` / `KeyboardAvoidingView`.
|
|
8
|
+
|
|
9
|
+
Works out of the box with Expo (SDK 50+) and bare React Native
|
|
10
|
+
(≥ 0.73). Sits on top of [`@poolse/react`](https://www.npmjs.com/package/@poolse/react)
|
|
11
|
+
(hooks) and [`@poolse/sdk`](https://www.npmjs.com/package/@poolse/sdk)
|
|
12
|
+
(client).
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @poolse/sdk @poolse/react @poolse/react-native react-native-svg
|
|
18
|
+
# optional — only required if you mount <AttachmentPicker>:
|
|
19
|
+
npx expo install expo-image-picker expo-document-picker
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick start
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { PoolseProvider } from '@poolse/react';
|
|
26
|
+
import { PoolseTheme, ConversationView } from '@poolse/react-native';
|
|
27
|
+
|
|
28
|
+
export default function ChatScreen({ conversationId }: { conversationId: string }) {
|
|
29
|
+
return (
|
|
30
|
+
<PoolseProvider config={{ getToken, userResolver }}>
|
|
31
|
+
<PoolseTheme>
|
|
32
|
+
<ConversationView conversationId={conversationId} />
|
|
33
|
+
</PoolseTheme>
|
|
34
|
+
</PoolseProvider>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The same `<PoolseProvider>` you use on web. Wrap it once at the app
|
|
40
|
+
root if you have multiple chat screens. Drop the `<PoolseTheme>`
|
|
41
|
+
wrapper if you don't need to override the brand defaults — every
|
|
42
|
+
component has a fallback theme baked in.
|
|
43
|
+
|
|
44
|
+
## What ships
|
|
45
|
+
|
|
46
|
+
| Component | What it does |
|
|
47
|
+
| --------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
48
|
+
| `<ConversationView>` | Composed chat surface — message list + composer + typing strip. Feature flags identical to web. |
|
|
49
|
+
| `<MessageBubble>` / `<EditableMessageBubble>` | Single message render — body, meta, read receipt, quoted card, in-bubble attachments. |
|
|
50
|
+
| `<MessageRow>` | Bubble + alignment + actions slot. |
|
|
51
|
+
| `<MessageList>` | Inverted `FlatList` wrapper — stick-to-bottom, hold-position, auto-load-more. |
|
|
52
|
+
| `<MessageComposer>` | Text input with auto-grow, send button, attach button, quote chip. |
|
|
53
|
+
| `<MessageActions>` | Long-press menu (reply / quote / edit / delete / copy / react). |
|
|
54
|
+
| `<TypingIndicator>` | Animated three-dot indicator + labels. |
|
|
55
|
+
| `<ThreadView>` | Modal screen for thread replies. |
|
|
56
|
+
| `<ConversationList>` | `FlatList` of conversation rows with unread badges. |
|
|
57
|
+
| `<MemberList>` | Member roster with avatars + remove action. |
|
|
58
|
+
| `<MentionInput>` | `TextInput` + autocomplete popover. |
|
|
59
|
+
| `<ReactionStrip>` / `<ReactionPicker>` | Reaction summary + emoji picker sheet. |
|
|
60
|
+
| `<AttachmentPreview>` | Image or file card. |
|
|
61
|
+
| `<AttachmentPicker>` | Wraps `expo-image-picker` + `expo-document-picker`. |
|
|
62
|
+
| `<UploadQueueStrip>` | Pending uploads with cancel. |
|
|
63
|
+
| `<UserName>` / `useDisplayName(externalId)` | Display name resolution via the SDK's `userResolver`. |
|
|
64
|
+
| `<Avatar>` | Initials + URL fallback, stable color per user. |
|
|
65
|
+
| `<PoolseIcon>` / `<PoolseLogo>` | Brand chrome via `react-native-svg`. |
|
|
66
|
+
|
|
67
|
+
## Theming
|
|
68
|
+
|
|
69
|
+
JS object via `<PoolseTheme theme={overrides}>`. The full token
|
|
70
|
+
surface mirrors the web `--poolse-*` CSS variables, grouped by
|
|
71
|
+
purpose:
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
<PoolseTheme
|
|
75
|
+
theme={{
|
|
76
|
+
colors: {
|
|
77
|
+
brand: '#ff5733',
|
|
78
|
+
brandSoft: '#ffe9e3',
|
|
79
|
+
onBrand: '#ffffff',
|
|
80
|
+
},
|
|
81
|
+
radii: {
|
|
82
|
+
bubble: 18,
|
|
83
|
+
},
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
{/* ... */}
|
|
87
|
+
</PoolseTheme>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Pass nothing to use the brand defaults. Pass `mode="dark"` to swap
|
|
91
|
+
to the warm dark palette. Deep-merges your overrides on top —
|
|
92
|
+
unspecified tokens keep their default.
|
|
93
|
+
|
|
94
|
+
## Lifecycle
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { useAppStateLifecycle } from '@poolse/react-native';
|
|
98
|
+
|
|
99
|
+
function App() {
|
|
100
|
+
useAppStateLifecycle();
|
|
101
|
+
return <PoolseProvider config={config}>{/* ... */}</PoolseProvider>;
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Closes the SDK WebSocket cleanly when the app backgrounds (iOS /
|
|
106
|
+
Android suspend sockets aggressively — keeping them open wastes
|
|
107
|
+
battery and produces no benefit). Reopens on foreground and triggers
|
|
108
|
+
a tail refetch on the currently-mounted `<ConversationView>` so the
|
|
109
|
+
user lands on a fresh state instead of catching up via stale
|
|
110
|
+
realtime.
|
|
111
|
+
|
|
112
|
+
Pair with push notifications on your backend (subscribe to
|
|
113
|
+
`message.created` / `mention.created` webhooks, fan out via APNs /
|
|
114
|
+
FCM / Expo's push service) — that's how the user learns about new
|
|
115
|
+
messages while the app is closed.
|
|
116
|
+
|
|
117
|
+
## Identity model
|
|
118
|
+
|
|
119
|
+
Same SDK 2.0 contract as the web side. All component props that
|
|
120
|
+
deal with users are keyed by your `external_id`:
|
|
121
|
+
|
|
122
|
+
- `useUser(externalId)`, `useDisplayName(externalId)`
|
|
123
|
+
- `<UserName externalId={message.sender_external_id} />`
|
|
124
|
+
- `<MemberList labelFor={(externalId) => ...} avatarFor={(externalId) => ...} onlineExternalIds={set} />`
|
|
125
|
+
- `<MessageBubble>` / `<MessageComposer>` / `<MentionInput>` / `<TypingIndicator>` — every `labelFor` is `(externalId) => string`.
|
|
126
|
+
|
|
127
|
+
The wire still carries `user_id` (the poolse uuid) alongside
|
|
128
|
+
`external_id`, but day-to-day app code never has to touch it.
|
|
129
|
+
|
|
130
|
+
## Differences from `@poolse/react-ui`
|
|
131
|
+
|
|
132
|
+
| Concern | Web (`react-ui`) | Native (`react-native`) |
|
|
133
|
+
| ------------------- | ----------------------------- | -------------------------------------------- |
|
|
134
|
+
| Styling | CSS variables in `styles.css` | JS theme via `<PoolseTheme>` |
|
|
135
|
+
| Action menu trigger | Hover | Long-press |
|
|
136
|
+
| Reaction picker | Inline popover | Modal sheet |
|
|
137
|
+
| Mention picker | Inline dropdown | Modal sheet |
|
|
138
|
+
| Attachment picker | `<input type=file>` | `expo-image-picker` + `expo-document-picker` |
|
|
139
|
+
| Message list | Reversed CSS flexbox | Inverted `FlatList` |
|
|
140
|
+
| Markdown | `react-markdown` | Plain text in 0.1 (markdown coming in 0.2) |
|
|
141
|
+
|
|
142
|
+
Everything else — feature flags, prop names, callback shapes,
|
|
143
|
+
hook signatures — is intentionally identical so a web codebase
|
|
144
|
+
ports across with mostly mechanical changes.
|