stream-chat-react-native-core 3.9.1 → 3.10.0-next.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/lib/commonjs/components/Channel/Channel.js +103 -75
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/ChannelList/Skeleton.js +14 -13
- package/lib/commonjs/components/ChannelList/Skeleton.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Channel/Channel.js +103 -75
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/ChannelList/Skeleton.js +14 -13
- package/lib/module/components/ChannelList/Skeleton.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/utils/renderText.js +1 -1
- package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/Channel/Channel.tsx +43 -15
- package/src/components/Channel/__tests__/Channel.test.js +18 -2
- package/src/components/ChannelList/Skeleton.tsx +2 -1
- package/src/components/Message/MessageSimple/utils/renderText.tsx +1 -1
- package/src/contexts/themeContext/utils/theme.ts +2 -1
- package/src/version.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext, useEffect } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { cleanup, render, waitFor } from '@testing-library/react-native';
|
|
3
|
+
import { act, cleanup, render, waitFor } from '@testing-library/react-native';
|
|
4
4
|
import { StreamChat } from 'stream-chat';
|
|
5
5
|
|
|
6
6
|
import { Channel } from '../Channel';
|
|
@@ -14,8 +14,10 @@ import {
|
|
|
14
14
|
MessagesProvider,
|
|
15
15
|
} from '../../../contexts/messagesContext/MessagesContext';
|
|
16
16
|
import { ThreadContext, ThreadProvider } from '../../../contexts/threadContext/ThreadContext';
|
|
17
|
+
|
|
17
18
|
import { useMockedApis } from '../../../mock-builders/api/useMockedApis';
|
|
18
19
|
import { getOrCreateChannelApi } from '../../../mock-builders/api/getOrCreateChannel';
|
|
20
|
+
import dispatchChannelDeletedEvent from '../../../mock-builders/event/channelDeleted';
|
|
19
21
|
import { generateChannel } from '../../../mock-builders/generator/channel';
|
|
20
22
|
import { generateMember } from '../../../mock-builders/generator/member';
|
|
21
23
|
import { generateMessage } from '../../../mock-builders/generator/message';
|
|
@@ -65,6 +67,7 @@ describe('Channel', () => {
|
|
|
65
67
|
chatClient = await getTestClientWithUser(user);
|
|
66
68
|
useMockedApis(chatClient, [getOrCreateChannelApi(mockedChannel)]);
|
|
67
69
|
channel = chatClient.channel('messaging', mockedChannel.id);
|
|
70
|
+
channel.cid = mockedChannel.channel.cid;
|
|
68
71
|
});
|
|
69
72
|
|
|
70
73
|
afterEach(() => {
|
|
@@ -77,7 +80,9 @@ describe('Channel', () => {
|
|
|
77
80
|
...channel,
|
|
78
81
|
cid: null,
|
|
79
82
|
off: () => {},
|
|
80
|
-
on: () => {
|
|
83
|
+
on: () => ({
|
|
84
|
+
unsubscribe: () => null,
|
|
85
|
+
}),
|
|
81
86
|
watch: () => {},
|
|
82
87
|
};
|
|
83
88
|
const { getByTestId } = renderComponent({ channel: nullChannel });
|
|
@@ -193,6 +198,17 @@ describe('Channel', () => {
|
|
|
193
198
|
await waitFor(() => expect(channelQuerySpy).toHaveBeenCalled());
|
|
194
199
|
});
|
|
195
200
|
|
|
201
|
+
it('should render null if channel gets deleted', async () => {
|
|
202
|
+
const { getByTestId, queryByTestId } = renderComponent({
|
|
203
|
+
channel,
|
|
204
|
+
children: <View testID='children' />,
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
await waitFor(() => expect(getByTestId('children')).toBeTruthy());
|
|
208
|
+
act(() => dispatchChannelDeletedEvent(chatClient, channel));
|
|
209
|
+
expect(queryByTestId('children')).toBeNull();
|
|
210
|
+
});
|
|
211
|
+
|
|
196
212
|
describe('ChannelContext', () => {
|
|
197
213
|
it('renders children without crashing', async () => {
|
|
198
214
|
const { getByTestId } = render(
|
|
@@ -41,6 +41,7 @@ export const Skeleton: React.FC = () => {
|
|
|
41
41
|
gradientStart,
|
|
42
42
|
gradientStop,
|
|
43
43
|
height = 64,
|
|
44
|
+
maskFillColor,
|
|
44
45
|
},
|
|
45
46
|
colors: { border, grey_gainsboro, white_snow },
|
|
46
47
|
},
|
|
@@ -138,7 +139,7 @@ export const Skeleton: React.FC = () => {
|
|
|
138
139
|
</Svg>
|
|
139
140
|
</Animated.View>
|
|
140
141
|
<Svg height={height} width={width}>
|
|
141
|
-
<Path d={d.value} fill={white_snow} />
|
|
142
|
+
<Path d={d.value} fill={maskFillColor || white_snow} />
|
|
142
143
|
</Svg>
|
|
143
144
|
</View>
|
|
144
145
|
);
|
|
@@ -262,7 +262,7 @@ export const renderText = <
|
|
|
262
262
|
<Markdown
|
|
263
263
|
key={`${JSON.stringify(mentioned_users)}-${onlyEmojis}-${
|
|
264
264
|
messageOverlay ? JSON.stringify(markdownStyles) : undefined
|
|
265
|
-
}`}
|
|
265
|
+
}-${JSON.stringify(colors)}`}
|
|
266
266
|
onLink={onLink}
|
|
267
267
|
rules={{
|
|
268
268
|
...customRules,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { vh } from '../../../utils/utils';
|
|
2
2
|
|
|
3
3
|
import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
|
|
4
|
-
import type { CircleProps, StopProps } from 'react-native-svg';
|
|
4
|
+
import type { CircleProps, Color, StopProps } from 'react-native-svg';
|
|
5
5
|
|
|
6
6
|
import type { IconProps } from '../../../icons/utils/base';
|
|
7
7
|
|
|
@@ -124,6 +124,7 @@ export type Theme = {
|
|
|
124
124
|
gradientStart: StopProps;
|
|
125
125
|
gradientStop: StopProps;
|
|
126
126
|
height: number;
|
|
127
|
+
maskFillColor?: Color;
|
|
127
128
|
};
|
|
128
129
|
channelPreview: {
|
|
129
130
|
checkAllIcon: IconProps;
|
package/src/version.json
CHANGED