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.
@@ -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
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "3.9.1"
2
+ "version": "3.10.0-next.1"
3
3
  }