Skip to content

Commit 0dd5f1a

Browse files
committed
2 parents 361f11a + 5388343 commit 0dd5f1a

File tree

9 files changed

+264
-59
lines changed

9 files changed

+264
-59
lines changed
1.45 MB
Loading
2.12 MB
Loading
1.49 MB
Loading
1.47 MB
Loading
2.15 MB
Loading
1.46 MB
Loading

docusaurus/docs/reactnative/basics/upgrade_helper.mdx

Lines changed: 117 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,30 @@ id: upgrading-from-v3
33
title: Upgrading from V3
44
---
55

6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
69
import pinMessageAction from '../assets/basics/upgrading-from-v3/pin_message_action.png';
710
import pinnedMessage from '../assets/basics/upgrading-from-v3/pinned_message.png';
811
import scrollViewWarning from '../assets/basics/upgrading-from-v3/scroll_view_warning.png';
912
import slowMode from '../assets/basics/upgrading-from-v3/slow_mode.gif';
1013

14+
import galleryBefore1 from '../assets/basics/upgrading-from-v3/gallery_before_1.png';
15+
import galleryBefore2 from '../assets/basics/upgrading-from-v3/gallery_before_2.png';
16+
import galleryBefore3 from '../assets/basics/upgrading-from-v3/gallery_before_3.png';
17+
import galleryAfter1 from '../assets/basics/upgrading-from-v3/gallery_after_1.png';
18+
import galleryAfter2 from '../assets/basics/upgrading-from-v3/gallery_after_2.png';
19+
import galleryAfter3 from '../assets/basics/upgrading-from-v3/gallery_after_3.png';
20+
1121
## Add a required `threadList` prop
1222

1323
Add a `threadList` prop on `Channel` component which wraps the Thread component as following:
1424

1525
(This change is only required if you use `Thread` component within your application. )
1626

1727
```tsx
18-
<Channel
19-
channel={channel}
20-
thread={thread}
21-
threadList
22-
>
23-
<Thread />
24-
</View>
28+
<Channel channel={channel} thread={thread} threadList>
29+
<Thread />
2530
</Channel>
2631
```
2732

@@ -209,6 +214,78 @@ npx pod-install
209214

210215
## Whats new in v4?
211216

217+
### Optimized Image Attachments
218+
219+
[Gallery](../ui-components/gallery.mdx) component has been revamped to be more performant and more responsive.
220+
Heavy images have been one of the crucial reasons previously for slow performance on low end devices. In this version of SDK,
221+
we render resized version of images to avoid heavy load on memory.
222+
223+
Also previously all the image attachments used to be rendered in fixed size container, which was not ideal for portrait or landscape images since
224+
user won't be able to see a cropped image on UI. In this version, we render images in dynamic size container, depending on aspect ratio of image.
225+
226+
<Tabs
227+
defaultValue='case1'
228+
values={[
229+
{ label: 'Case 1', value: 'case1' },
230+
{ label: 'Case 2', value: 'case2' },
231+
{ label: 'Case 3', value: 'case3' },
232+
]}
233+
>
234+
<TabItem value='case1'>
235+
236+
<table>
237+
<tr>
238+
<td align='center'>Before</td>
239+
<td align='center'>After</td>
240+
</tr>
241+
<tr>
242+
<td align='center' width='50%'>
243+
<img src={galleryBefore1} />
244+
</td>
245+
<td align='center' width='50%'>
246+
<img src={galleryAfter1} />
247+
</td>
248+
</tr>
249+
</table>
250+
251+
</TabItem>
252+
<TabItem value='case2'>
253+
254+
<table>
255+
<tr>
256+
<td align='center'>Before</td>
257+
<td align='center'>After</td>
258+
</tr>
259+
<tr>
260+
<td align='center' width='50%'>
261+
<img src={galleryBefore2} />
262+
</td>
263+
<td align='center' width='50%'>
264+
<img src={galleryAfter2} />
265+
</td>
266+
</tr>
267+
</table>
268+
269+
</TabItem>
270+
<TabItem value='case3'>
271+
<table>
272+
<tr>
273+
<td align='center'>Before</td>
274+
<td align='center'>After</td>
275+
</tr>
276+
<tr>
277+
<td align='center' width='50%'>
278+
<img src={galleryBefore3} />
279+
</td>
280+
<td align='center' width='50%'>
281+
<img src={galleryAfter3} />
282+
</td>
283+
</tr>
284+
<tr></tr>
285+
</table>
286+
</TabItem>
287+
</Tabs>
288+
212289
### Slow Mode Feature
213290

214291
Slow mode helps reduce noise on a channel by limiting users to a maximum of 1 message per cooldown interval.
@@ -269,6 +346,8 @@ You can override these capabilities on UI level by providing [`overrideOwnCapabi
269346

270347
### UI/UX Changes and Performance Improvements
271348

349+
- Images will be rendered
350+
272351
- Background for the overlay which opens up when user long-presses on a message, has been replaced with
273352
opacity based background instead of [BlurView](https://github.com/Kureev/react-native-blur) [#874](https://github.com/GetStream/stream-chat-react-native/pull/874)
274353
This dependency caused a lot of issues due to its underlying native [BlurView](https://github.com/Dimezis/BlurView) dependency.
@@ -287,18 +366,18 @@ You can override these capabilities on UI level by providing [`overrideOwnCapabi
287366

288367
Following two new props on `Channel` componenent allows customizing UI for autocomplete suggestions list:
289368

290-
- `AutoCompleteSuggestionHeader`
291-
- `AutoCompleteSuggestionList`
292-
- `AutoCompleteSuggestionItem`
369+
- [`AutoCompleteSuggestionHeader`](../core-components/channel.mdx#autocompletesuggestionheader)
370+
- [`AutoCompleteSuggestionList`](../core-components/channel.mdx#autocompletesuggestionlist)
371+
- [`AutoCompleteSuggestionItem`](../core-components/channel.mdx#autocompletesuggestionitem)
293372

294373
For details please read the docs on [Autocomplete Suggestions Customizations](../guides/auto_complete_suggestion_list_customizations.mdx)
295374

296375
#### Message Actions
297376

298377
Following two new props on `OverlayProvider` component allows customizing UI for message actions:
299378

300-
- `MessageActionList`
301-
- `MessageActionListItem`
379+
- [`MessageActionList`](../core-components/overlay_provider.mdx#messageactionlist)
380+
- [`MessageActionListItem`](../core-components/overlay_provider.mdx#messageactionlistitem)
302381

303382
Additionally styles of the message actions can be customized using following new theme keys:
304383

@@ -329,6 +408,11 @@ This prop has following 4 possible values:
329408
- `sender`: The deleted messages in the channel will only be visible to sender.
330409
- `receiver`: The deleted messages in the channel will only be visible to receiver.
331410

411+
#### Overlay Reactions User Avatar
412+
413+
Avatar of users (shown in OverlayReactions component) who reacted to message, can now be customized
414+
using a prop on `OverlayProvide` component - [`OverlayReactionsAvatar`](../core-components/overlay_provider.mdx#overlayreactionsavatar).
415+
332416
### Fixes Issues
333417

334418
#### Warning about Virtualized List wrapped inside ScrollView
@@ -346,3 +430,24 @@ You can customize the truncation length of message text by providing a prop [`me
346430
```tsx
347431
<OverlayProvider messageTextNumberOfLines={300}>{/** child components */}</OverlayProvider>
348432
```
433+
434+
#### ChannelList ignores updated filters if api call is in progress
435+
436+
https://github.com/GetStream/stream-chat-react-native/issues/678
437+
438+
If the screen which creates the filter prop for ChannelList quickly renders two or more
439+
different filters, only the first filter will be fetched, with the subsequent filters
440+
being discarded. This results in a stale ChannelList until it is manually refreshed.
441+
442+
#### Failed messages can't be deleted
443+
444+
Delete action on failed message would result in error previously, which has been fixed in this release.
445+
446+
#### Mentioned users get removed after editing message
447+
448+
https://github.com/GetStream/stream-chat-react-native/issues/1023
449+
450+
#### Url parsing crashes the app when text contains special character
451+
452+
Application would crash if the message text contains special character and someone
453+
replies to the message. This has been fixed in this release.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import React from 'react';
2+
import { Text } from 'react-native';
3+
4+
import { render, waitFor } from '@testing-library/react-native';
5+
6+
// @ts-ignore
7+
import { ASTNode, SingleASTNode } from 'simple-markdown';
8+
9+
import { ListOutput, ListOutputProps } from './renderText';
10+
11+
describe('list', () => {
12+
const createNode = ({
13+
amount,
14+
ordered = false,
15+
start = 1,
16+
}: {
17+
amount: number;
18+
ordered?: boolean;
19+
start?: number;
20+
}): SingleASTNode => ({
21+
items: Array.from(Array(amount).keys()),
22+
ordered,
23+
start,
24+
type: 'text',
25+
});
26+
27+
const mockOutput = (node: ASTNode) => <Text>{node}</Text>;
28+
const MockText = ({ node, output, state }: ListOutputProps) => (
29+
<>
30+
<ListOutput node={node} output={output} state={state} styles={{}} />
31+
</>
32+
);
33+
34+
it('renders numbered items', async () => {
35+
const node = createNode({ amount: 3, ordered: true, start: 1 });
36+
const { getByText } = render(<MockText node={node} output={mockOutput} state={{}} />);
37+
38+
await waitFor(() => expect(getByText('1. ')).toBeTruthy());
39+
await waitFor(() => expect(getByText('2. ')).toBeTruthy());
40+
await waitFor(() => expect(getByText('3. ')).toBeTruthy());
41+
});
42+
43+
it('renders numbered items from a start index', async () => {
44+
const node = createNode({ amount: 3, ordered: true, start: 3 });
45+
const { getByText } = render(<MockText node={node} output={mockOutput} state={{}} />);
46+
47+
await waitFor(() => expect(getByText('3. ')).toBeTruthy());
48+
await waitFor(() => expect(getByText('4. ')).toBeTruthy());
49+
await waitFor(() => expect(getByText('5. ')).toBeTruthy());
50+
});
51+
52+
it('does not throw an error if an item is empty', async () => {
53+
const node = {
54+
...createNode({ amount: 3, ordered: true }),
55+
items: ['Not empty', null, 'Not empty'],
56+
};
57+
const { getByText } = render(<MockText node={node} output={mockOutput} state={{}} />);
58+
59+
await waitFor(() => expect(getByText('1. ')).toBeTruthy());
60+
await waitFor(() => expect(getByText('2. ')).toBeTruthy());
61+
await waitFor(() => expect(getByText('3. ')).toBeTruthy());
62+
});
63+
64+
it('renders an unordered list', async () => {
65+
const node = createNode({ amount: 3 });
66+
const { getAllByText } = render(<MockText node={node} output={mockOutput} state={{}} />);
67+
68+
await waitFor(() => expect(getAllByText('\u2022 ')).toHaveLength(3));
69+
});
70+
});

0 commit comments

Comments
 (0)