Skip to content

Commit 2eae95f

Browse files
committed
Merge branch 'develop' into feat/polls-impl
# Conflicts: # examples/SampleApp/yarn.lock # package/package.json # package/src/contexts/messagesContext/MessagesContext.tsx # package/yarn.lock
2 parents a7c92b5 + 424aefb commit 2eae95f

File tree

38 files changed

+410
-295
lines changed

38 files changed

+410
-295
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Boolean to enable/disable the message underlay background when there are unread messages in the Message List.
2+
3+
| Type | Default |
4+
| ---------------------- | ------- |
5+
| `boolean`\|`undefined` | `true` |

docusaurus/docs/reactnative/contexts/messages-context.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import OverlayReactionList from '../common-content/ui-components/overlay-provide
6666
import ReactionList from '../common-content/ui-components/channel/props/reaction-list.mdx';
6767
import Reply from '../common-content/ui-components/channel/props/reply.mdx';
6868
import ScrollToBottomButton from '../common-content/ui-components/channel/props/scroll-to-bottom-button.mdx';
69+
import ShouldShowUnreadUnderlay from '../common-content/ui-components/channel/props/should_show_unread_underlay.mdx';
6970
import SelectReaction from '../common-content/ui-components/channel/props/select_reaction.mdx';
7071
import SupportedReactions from '../common-content/ui-components/channel/props/supported_reactions.mdx';
7172
import TypingIndicator from '../common-content/ui-components/channel/props/typing_indicator.mdx';
@@ -235,6 +236,10 @@ Enables quoted-reply state on given message.
235236
| ------------------- |
236237
| `(message) => void` |
237238

239+
### <div class="label description">_forwarded from [Channel](../../core-components/channel#shouldshowunreadunderlay)_ props</div> shouldShowUnreadUnderlay {#shouldshowunreadunderlay}
240+
241+
<ShouldShowUnreadUnderlay />
242+
238243
### <div class="label description">_forwarded from [Channel](../../core-components/channel#supportedreactions)_ props</div> supportedReactions {#supportedreactions}
239244

240245
<SupportedReactions />

docusaurus/docs/reactnative/core-components/channel-list.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ export const App = () => <OverlayProvider>
4040
</OverlayProvider>;
4141
```
4242

43+
:::note
44+
When receiving channel information from channel events, the filters are not respected; the reason for this is that channel filters can get very complex, and implementing that filtering logic that supports all of the custom filter would be very hard to do. Implementing this on the backend side isn't an option as it is inefficient and has to cater to different filters. So, to help you with it, you will have to override the `notification.message_new` event using the [`onNewMessageNotification`](./channel-list.mdx#onnewmessagenotification) and `message.new` event handlers using the [`onNewMessage`](./channel-list.mdx#onnewmessage) prop of the `ChannelList` component.
45+
:::
46+
4347
## Context Providers
4448

4549
`ChannelList` contains the provider for the `ChannelsContext`. This can be accessed using the corresponding hook.

docusaurus/docs/reactnative/core-components/channel.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ import ScrollToBottomButton from '../common-content/ui-components/channel/props/
134134
import SelectReaction from '../common-content/ui-components/channel/props/select_reaction.mdx';
135135
import SendButton from '../common-content/ui-components/channel/props/send_button.mdx';
136136
import SendMessageDisallowedIndicator from '../common-content/ui-components/channel/props/send_message_disallowed_indicator.mdx';
137+
import ShouldShowUnreadUnderlay from '../common-content/ui-components/channel/props/should_show_unread_underlay.mdx';
137138
import ShowThreadMessageInChannelButton from '../common-content/ui-components/channel/props/show_thread_message_in_channel_button.mdx';
138139
import StartAudioRecordingButton from '../common-content/ui-components/channel/props/start_audio_recording_button.mdx';
139140
import StateUpdateThrottleInterval from '../common-content/ui-components/channel/props/state_update_throttle_interval.mdx';
@@ -702,6 +703,10 @@ Callback function to set the [ref](https://reactjs.org/docs/refs-and-the-dom.htm
702703
| --------- | -------------------- |
703704
| ref | ref of the TextInput |
704705

706+
### `shouldShowUnreadUnderlay`
707+
708+
<ShouldShowUnreadUnderlay />
709+
705710
### stateUpdateThrottleInterval
706711

707712
<StateUpdateThrottleInterval />

docusaurus/docs/reactnative/state-and-offline-support/state-overview.mdx

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -266,40 +266,45 @@ Selectors are functions provided by integrators that run whenever state object c
266266

267267
#### Rules of Selectors
268268

269-
1. Selectors should return array of data sorted by their "change factor"; meaning values that change often should come first for the best performance.
269+
1. Selectors should return a named object.
270270

271271
```ts
272-
const selector = (nextValue: ThreadManagerState) => [
273-
nextValue.unreadThreadsCount, // <-- changes often
274-
nextValue.active, // <-- changes less often
275-
nextvalue.lastConnectionDownAt, // <-- changes rarely
276-
];
272+
const selector = (nextValue: ThreadManagerState) => ({
273+
unreadThreadsCount: nextValue.unreadThreadsCount,
274+
active: nextValue.active,
275+
lastConnectionDownAt: nextvalue.lastConnectionDownAt,
276+
});
277277
```
278278

279-
2. Selectors should live outside components scope or should be memoized if it requires "outside" information (`userId` for `read` object for example). Not memoizing selectors (or not stabilizing them) will lead to bad performance as each time your component re-renders, the selector function is created anew and `useSimpleStateStore` goes through unsubscribe and resubscribe process unnecessarily.
279+
2. Selectors should live outside components scope or should be memoized if it requires "outside" information (`userId` for `read` object for example). Not memoizing selectors (or not stabilizing them) will lead to bad performance as each time your component re-renders, the selector function is created anew and `useStateStore` goes through unsubscribe and resubscribe process unnecessarily.
280280

281281
```tsx
282282
// ❌ not okay
283283
const Component1 = () => {
284-
const [latestReply] = useStateStore(thread.state, (nextValue: ThreadState) => [nextValue.latestReplies.at(-1)]);
284+
const { latestReply } = useStateStore(thread.state, (nextValue: ThreadState) => ({
285+
latestReply: nextValue.latestReplies.at(-1),
286+
}));
285287

286288
return <Text>{latestReply.text}</Text>;
287289
};
288290

289291
// ✅ okay
290-
const selector = (nextValue: ThreadState) => [nextValue.latestReplies.at(-1)];
292+
const selector = (nextValue: ThreadState) => ({ latestReply: nextValue.latestReplies.at(-1) });
291293

292294
const Component2 = () => {
293-
const [latestReply] = useStateStore(thread.state, selector);
295+
const { latestReply } = useStateStore(thread.state, selector);
294296

295297
return <Text>{latestReply.text}</Text>;
296298
};
297299

298300
// ✅ also okay
299301
const Component3 = ({ userId }: { userId: string }) => {
300-
const selector = useCallback((nextValue: ThreadState) => [nextValue.read[userId].unread_messages], [userId]);
302+
const selector = useCallback(
303+
(nextValue: ThreadState) => ({ unreadMessagesCount: nextValue.read[userId].unread_messages }),
304+
[userId],
305+
);
301306

302-
const [unreadMessagesCount] = useStateStore(thread.state, selector);
307+
const { unreadMessagesCount } = useStateStore(thread.state, selector);
303308

304309
return <Text>{unreadMessagesCount}</Text>;
305310
};
@@ -324,9 +329,9 @@ client.threads.state.subscribe(console.log);
324329
let latestThreads;
325330
client.threads.state.subscribeWithSelector(
326331
// called each time theres a change in the state object
327-
nextValue => [nextValue.threads],
332+
nextValue => ({ threads: nextValue.threads }),
328333
// called only when threads change (selected value)
329-
([threads]) => {
334+
({ threads }) => {
330335
latestThreads = threads;
331336
},
332337
);
@@ -344,17 +349,17 @@ thread?.state.getLatestValue(/*...*/);
344349

345350
#### useStateStore Hook
346351

347-
For the ease of use - the React SDK comes with the appropriate state access hook which wraps `SimpleStateStore.subscribeWithSelector` API for the React-based applications.
352+
For the ease of use - the React SDK comes with the appropriate state access hook which wraps `StateStore.subscribeWithSelector` API for the React-based applications.
348353

349354
```tsx
350355
import { useStateStore } from 'stream-chat-react-native';
351356
import type { ThreadManagerState } from 'stream-chat';
352357

353-
const selector = (nextValue: ThreadManagerState) => [nextValue.threads] as const;
358+
const selector = (nextValue: ThreadManagerState) => ({ threads: nextValue.threads }) as const;
354359

355360
const CustomThreadList = () => {
356361
const { client } = useChatContext();
357-
const [threads] = useStateStore(client.threads.state, selector);
362+
const { threads } = useStateStore(client.threads.state, selector);
358363

359364
return (
360365
<View>

examples/ExpoMessaging/yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7310,10 +7310,10 @@ [email protected], stream-buffers@~2.2.0:
73107310
version "0.0.0"
73117311
uid ""
73127312

7313-
7314-
version "5.39.0"
7315-
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.39.0.tgz#499db88ff9a6ef2f93012f2dd1c0feb3c849859c"
7316-
integrity sha512-dzA/N3pOWMmRtNmMWYfnOnGSBG+K+ReKqLL3CXYmSnUmEHQlJwHqKDLPlxnNY8IOT2Nh067m04aB+1OQZpi/Mw==
7313+
7314+
version "5.39.6"
7315+
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.39.6.tgz#bc40925070a55e45afb98d6518c899ab80273486"
7316+
integrity sha512-DlPC4UzBa/aP7UeT/e0axJ/S4y3QQ1TS6oxrYVQlZGasFxgmL+OUDfoj6HwX9J/DOSrogw9/YF6yZLXTorlB/g==
73177317
dependencies:
73187318
"@gorhom/bottom-sheet" "^4.6.4"
73197319
dayjs "1.10.5"
@@ -7326,16 +7326,16 @@ [email protected]:
73267326
path "0.12.7"
73277327
react-native-markdown-package "1.8.2"
73287328
react-native-url-polyfill "^1.3.0"
7329-
stream-chat "8.40.8"
7329+
stream-chat "8.41.1"
73307330

73317331
"stream-chat-react-native-core@link:../../package":
73327332
version "0.0.0"
73337333
uid ""
73347334

7335-
stream-chat@8.40.8:
7336-
version "8.40.8"
7337-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.40.8.tgz#0f5320bd8b03d1cbff377f8c7ae2f8afe24d0515"
7338-
integrity sha512-nYLvYAkrvXRzuPO52TIofNiInCkDdXrnBc/658297lC6hzrHNc87mmTht264BXmXLlpasTNP3rLKxR6MxhpgKg==
7335+
stream-chat@8.41.1:
7336+
version "8.41.1"
7337+
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.41.1.tgz#c991980b800b67ec38202a1aa3bbbd4112ccb5fa"
7338+
integrity sha512-WV0mHHm88D4RbAV42sD0+SqTWLCvjIwfGZ3nSBXRAuGpVYJEqnNUhEd4OIQ+YrXVbjY7qWz9L5XRk5fZIfE9kg==
73397339
dependencies:
73407340
"@babel/runtime" "^7.16.3"
73417341
"@types/jsonwebtoken" "~9.0.0"

examples/SampleApp/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Change Log
22

3+
### [1.30.6](https://github.com/GetStream/stream-chat-react-native/compare/[email protected]@v1.30.6) (2024-10-28)
4+
5+
6+
### Workspaces
7+
8+
* Following linked packages updated: [stream-chat-react-native]
9+
10+
### [1.30.5](https://github.com/GetStream/stream-chat-react-native/compare/[email protected]@v1.30.5) (2024-10-24)
11+
12+
13+
### Workspaces
14+
15+
* Following linked packages updated: [stream-chat-react-native]
16+
317
### [1.30.4](https://github.com/GetStream/stream-chat-react-native/compare/[email protected]@v1.30.4) (2024-10-21)
418

519

0 commit comments

Comments
 (0)