stream-chat-react-native-core 4.3.1-beta.1 → 4.3.1-beta.2
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/Attachment/Giphy.js +26 -22
- package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Chat/Chat.js +8 -4
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useAppSettings.js +80 -0
- package/lib/commonjs/components/Chat/hooks/useAppSettings.js.map +1 -0
- package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js +3 -1
- package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +4 -4
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +4 -4
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.md +1 -1
- package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.md +2 -2
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.md +2 -2
- package/lib/commonjs/contexts/chatContext/ChatContext.js +2 -2
- package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/commonjs/contexts/chatContext/ChatContext.md +2 -2
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.md +2 -2
- package/lib/commonjs/contexts/keyboardContext/KeyboardContext.md +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.md +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.md +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.md +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayContext.md +2 -2
- package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.md +2 -2
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.md +1 -1
- package/lib/commonjs/contexts/typingContext/TypingContext.md +2 -2
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Giphy.js +26 -22
- package/lib/module/components/Attachment/Giphy.js.map +1 -1
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Chat/Chat.js +8 -4
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/Chat/hooks/useAppSettings.js +80 -0
- package/lib/module/components/Chat/hooks/useAppSettings.js.map +1 -0
- package/lib/module/components/Chat/hooks/useCreateChatContext.js +3 -1
- package/lib/module/components/Chat/hooks/useCreateChatContext.js.map +1 -1
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +4 -4
- package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js +4 -4
- package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/utils/renderText.md +1 -1
- package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.md +2 -2
- package/lib/module/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/module/contexts/channelsContext/ChannelsContext.md +2 -2
- package/lib/module/contexts/chatContext/ChatContext.js +2 -2
- package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/module/contexts/chatContext/ChatContext.md +2 -2
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.md +2 -2
- package/lib/module/contexts/keyboardContext/KeyboardContext.md +1 -1
- package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/module/contexts/messageContext/MessageContext.md +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.md +1 -1
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.md +1 -1
- package/lib/module/contexts/overlayContext/OverlayContext.md +2 -2
- package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.md +2 -2
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.md +1 -1
- package/lib/module/contexts/typingContext/TypingContext.md +2 -2
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts +4 -4
- package/lib/typescript/components/Channel/Channel.d.ts +2 -2
- package/lib/typescript/components/Chat/Chat.d.ts +1 -1
- package/lib/typescript/components/Chat/hooks/__tests__/useAppSettings.test.d.ts +1 -0
- package/lib/typescript/components/Chat/hooks/useAppSettings.d.ts +3 -0
- package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts +1 -1
- package/lib/typescript/components/Message/Message.d.ts +2 -2
- package/lib/typescript/contexts/attachmentPickerContext/AttachmentPickerContext.d.ts +3 -3
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +2 -2
- package/lib/typescript/contexts/channelsContext/ChannelsContext.d.ts +6 -6
- package/lib/typescript/contexts/chatContext/ChatContext.d.ts +5 -1
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +2 -2
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +6 -6
- package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +3 -3
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +20 -20
- package/package.json +1 -1
- package/src/components/Attachment/Giphy.tsx +4 -0
- package/src/components/Attachment/__tests__/Attachment.test.js +0 -61
- package/src/components/Attachment/__tests__/Giphy.test.js +290 -0
- package/src/components/AttachmentPicker/AttachmentPicker.tsx +4 -4
- package/src/components/Channel/Channel.tsx +2 -2
- package/src/components/Channel/__tests__/isAttachmentEqualHandler.test.js +1 -1
- package/src/components/ChannelList/hooks/listeners/__tests__/useChannelUpdated.test.tsx +1 -0
- package/src/components/Chat/Chat.tsx +5 -1
- package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx +34 -0
- package/src/components/Chat/hooks/useAppSettings.ts +39 -0
- package/src/components/Chat/hooks/useCreateChatContext.ts +2 -0
- package/src/components/Message/Message.tsx +2 -2
- package/src/components/Message/MessageSimple/MessageContent.tsx +16 -17
- package/src/components/Message/MessageSimple/MessageSimple.tsx +11 -12
- package/src/components/Message/MessageSimple/utils/renderText.md +1 -1
- package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx +3 -3
- package/src/contexts/channelContext/ChannelContext.md +2 -2
- package/src/contexts/channelContext/ChannelContext.tsx +2 -2
- package/src/contexts/channelsContext/ChannelsContext.md +2 -2
- package/src/contexts/channelsContext/ChannelsContext.tsx +6 -6
- package/src/contexts/chatContext/ChatContext.md +2 -2
- package/src/contexts/chatContext/ChatContext.tsx +5 -1
- package/src/contexts/imageGalleryContext/ImageGalleryContext.md +2 -2
- package/src/contexts/keyboardContext/KeyboardContext.md +1 -1
- package/src/contexts/messageContext/MessageContext.md +1 -1
- package/src/contexts/messageContext/MessageContext.tsx +2 -2
- package/src/contexts/messageInputContext/MessageInputContext.md +1 -1
- package/src/contexts/messageInputContext/MessageInputContext.tsx +6 -6
- package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +3 -3
- package/src/contexts/messagesContext/MessagesContext.md +1 -1
- package/src/contexts/messagesContext/MessagesContext.tsx +20 -20
- package/src/contexts/overlayContext/OverlayContext.md +2 -2
- package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.md +2 -2
- package/src/contexts/suggestionsContext/SuggestionsContext.md +1 -1
- package/src/contexts/typingContext/TypingContext.md +2 -2
- package/src/version.json +1 -1
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { fireEvent, render, waitFor } from '@testing-library/react-native';
|
|
4
|
+
|
|
5
|
+
import { MessageProvider } from '../../../contexts/messageContext/MessageContext';
|
|
6
|
+
import { OverlayProvider } from '../../../contexts/overlayContext/OverlayProvider';
|
|
7
|
+
|
|
8
|
+
import { ThemeProvider } from '../../../contexts/themeContext/ThemeContext';
|
|
9
|
+
import { getOrCreateChannelApi } from '../../../mock-builders/api/getOrCreateChannel';
|
|
10
|
+
import { useMockedApis } from '../../../mock-builders/api/useMockedApis';
|
|
11
|
+
import {
|
|
12
|
+
generateGiphyAttachment,
|
|
13
|
+
generateImgurAttachment,
|
|
14
|
+
} from '../../../mock-builders/generator/attachment';
|
|
15
|
+
import { generateChannelResponse } from '../../../mock-builders/generator/channel';
|
|
16
|
+
import { generateMember } from '../../../mock-builders/generator/member';
|
|
17
|
+
import { generateMessage } from '../../../mock-builders/generator/message';
|
|
18
|
+
import { generateUser } from '../../../mock-builders/generator/user';
|
|
19
|
+
import { getTestClientWithUser } from '../../../mock-builders/mock';
|
|
20
|
+
import { Channel } from '../../Channel/Channel';
|
|
21
|
+
import { Chat } from '../../Chat/Chat';
|
|
22
|
+
import { MessageList } from '../../MessageList/MessageList';
|
|
23
|
+
import { Giphy } from '../Giphy';
|
|
24
|
+
|
|
25
|
+
describe('Giphy', () => {
|
|
26
|
+
const getAttachmentComponent = (props) => {
|
|
27
|
+
const message = generateMessage();
|
|
28
|
+
return (
|
|
29
|
+
<ThemeProvider>
|
|
30
|
+
<MessageProvider value={{ message }}>
|
|
31
|
+
<Giphy {...props} />
|
|
32
|
+
</MessageProvider>
|
|
33
|
+
</ThemeProvider>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
it('should render Card component for "imgur" type attachment', async () => {
|
|
38
|
+
const attachment = generateImgurAttachment();
|
|
39
|
+
const { getByTestId } = render(getAttachmentComponent({ attachment }));
|
|
40
|
+
|
|
41
|
+
await waitFor(() => {
|
|
42
|
+
expect(getByTestId('giphy-attachment')).toBeTruthy();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should render Card component for "giphy" type attachment', async () => {
|
|
47
|
+
const attachment = generateGiphyAttachment();
|
|
48
|
+
const { getByTestId } = render(getAttachmentComponent({ attachment }));
|
|
49
|
+
|
|
50
|
+
await waitFor(() => {
|
|
51
|
+
expect(getByTestId('giphy-attachment')).toBeTruthy();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('"giphy" attachment size should be customisable', async () => {
|
|
56
|
+
const attachment = generateGiphyAttachment();
|
|
57
|
+
attachment.giphy = {
|
|
58
|
+
fixed_height: {
|
|
59
|
+
height: '200',
|
|
60
|
+
url: 'https://media1.giphy.com/media/test/fixed_height.gif',
|
|
61
|
+
width: '375',
|
|
62
|
+
},
|
|
63
|
+
original: {
|
|
64
|
+
height: '256',
|
|
65
|
+
url: 'https://media1.giphy.com/media/test/original.gif',
|
|
66
|
+
width: '480',
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
const { getByTestId: getByTestIdFixedHeight } = render(
|
|
70
|
+
getAttachmentComponent({ attachment, giphyVersion: 'fixed_height' }),
|
|
71
|
+
);
|
|
72
|
+
const { getByTestId: getByTestIdOriginal } = render(
|
|
73
|
+
getAttachmentComponent({ attachment, giphyVersion: 'original' }),
|
|
74
|
+
);
|
|
75
|
+
await waitFor(() => {
|
|
76
|
+
const checkImageProps = (imageProps, specificSizedGiphyData) => {
|
|
77
|
+
let imageStyle = imageProps.style;
|
|
78
|
+
if (Array.isArray(imageStyle)) {
|
|
79
|
+
imageStyle = Object.assign({}, ...imageStyle);
|
|
80
|
+
}
|
|
81
|
+
expect(imageStyle.height).toBe(parseFloat(specificSizedGiphyData.height));
|
|
82
|
+
expect(imageStyle.width).toBe(parseFloat(specificSizedGiphyData.width));
|
|
83
|
+
expect(imageProps.source.uri).toBe(specificSizedGiphyData.url);
|
|
84
|
+
};
|
|
85
|
+
checkImageProps(
|
|
86
|
+
getByTestIdFixedHeight('giphy-attachment-image').props,
|
|
87
|
+
attachment.giphy.fixed_height,
|
|
88
|
+
);
|
|
89
|
+
checkImageProps(
|
|
90
|
+
getByTestIdOriginal('giphy-attachment-image').props,
|
|
91
|
+
attachment.giphy.original,
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('show render giphy action UI and all the 3 action buttons', async () => {
|
|
97
|
+
const attachment = generateGiphyAttachment();
|
|
98
|
+
attachment.actions = [
|
|
99
|
+
{ name: 'image_action', text: 'Send', value: 'send' },
|
|
100
|
+
{ name: 'image_action', text: 'Shuffle', value: 'shuffle' },
|
|
101
|
+
{
|
|
102
|
+
name: 'image_action',
|
|
103
|
+
text: 'Cancel',
|
|
104
|
+
value: 'cancel',
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
const { getByTestId } = render(
|
|
108
|
+
getAttachmentComponent({ attachment, giphyVersion: 'fixed_height' }),
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
await waitFor(() => {
|
|
112
|
+
expect(getByTestId('giphy-action-attachment')).toBeTruthy();
|
|
113
|
+
expect(getByTestId('cancel-action-button')).toBeTruthy();
|
|
114
|
+
expect(getByTestId('shuffle-action-button')).toBeTruthy();
|
|
115
|
+
expect(getByTestId('send-action-button')).toBeTruthy();
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('should trigger the cancel giphy action', async () => {
|
|
120
|
+
const attachment = generateGiphyAttachment();
|
|
121
|
+
const handleAction = jest.fn();
|
|
122
|
+
attachment.actions = [
|
|
123
|
+
{ name: 'image_action', text: 'Send', value: 'send' },
|
|
124
|
+
{ name: 'image_action', text: 'Shuffle', value: 'shuffle' },
|
|
125
|
+
{
|
|
126
|
+
name: 'image_action',
|
|
127
|
+
text: 'Cancel',
|
|
128
|
+
value: 'cancel',
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
const { getByTestId } = render(
|
|
132
|
+
getAttachmentComponent({
|
|
133
|
+
attachment,
|
|
134
|
+
giphyVersion: 'fixed_height',
|
|
135
|
+
handleAction,
|
|
136
|
+
}),
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
await waitFor(() => getByTestId(`${attachment.actions[2].value}-action-button`));
|
|
140
|
+
|
|
141
|
+
expect(getByTestId('giphy-action-attachment')).toContainElement(
|
|
142
|
+
getByTestId(`${attachment.actions[2].value}-action-button`),
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
fireEvent.press(getByTestId(`${attachment.actions[2].value}-action-button`));
|
|
146
|
+
|
|
147
|
+
await waitFor(() => {
|
|
148
|
+
expect(handleAction).toHaveBeenCalledTimes(1);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('should trigger the shuffle giphy action', async () => {
|
|
153
|
+
const attachment = generateGiphyAttachment();
|
|
154
|
+
const handleAction = jest.fn();
|
|
155
|
+
attachment.actions = [
|
|
156
|
+
{ name: 'image_action', text: 'Send', value: 'send' },
|
|
157
|
+
{ name: 'image_action', text: 'Shuffle', value: 'shuffle' },
|
|
158
|
+
{
|
|
159
|
+
name: 'image_action',
|
|
160
|
+
text: 'Cancel',
|
|
161
|
+
value: 'cancel',
|
|
162
|
+
},
|
|
163
|
+
];
|
|
164
|
+
const { getByTestId } = render(
|
|
165
|
+
getAttachmentComponent({
|
|
166
|
+
attachment,
|
|
167
|
+
giphyVersion: 'fixed_height',
|
|
168
|
+
handleAction,
|
|
169
|
+
}),
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
await waitFor(() => getByTestId(`${attachment.actions[1].value}-action-button`));
|
|
173
|
+
|
|
174
|
+
expect(getByTestId('giphy-action-attachment')).toContainElement(
|
|
175
|
+
getByTestId(`${attachment.actions[1].value}-action-button`),
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
fireEvent.press(getByTestId(`${attachment.actions[1].value}-action-button`));
|
|
179
|
+
|
|
180
|
+
await waitFor(() => {
|
|
181
|
+
expect(handleAction).toHaveBeenCalledTimes(1);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it('should trigger the send giphy action', async () => {
|
|
186
|
+
const attachment = generateGiphyAttachment();
|
|
187
|
+
const handleAction = jest.fn();
|
|
188
|
+
attachment.actions = [
|
|
189
|
+
{ name: 'image_action', text: 'Send', value: 'send' },
|
|
190
|
+
{ name: 'image_action', text: 'Shuffle', value: 'shuffle' },
|
|
191
|
+
{
|
|
192
|
+
name: 'image_action',
|
|
193
|
+
text: 'Cancel',
|
|
194
|
+
value: 'cancel',
|
|
195
|
+
},
|
|
196
|
+
];
|
|
197
|
+
const { getByTestId } = render(
|
|
198
|
+
getAttachmentComponent({
|
|
199
|
+
attachment,
|
|
200
|
+
giphyVersion: 'fixed_height',
|
|
201
|
+
handleAction,
|
|
202
|
+
}),
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
await waitFor(() => getByTestId(`${attachment.actions[0].value}-action-button`));
|
|
206
|
+
|
|
207
|
+
expect(getByTestId('giphy-action-attachment')).toContainElement(
|
|
208
|
+
getByTestId(`${attachment.actions[0].value}-action-button`),
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
fireEvent.press(getByTestId(`${attachment.actions[0].value}-action-button`));
|
|
212
|
+
|
|
213
|
+
await waitFor(() => {
|
|
214
|
+
expect(handleAction).toHaveBeenCalledTimes(1);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
it('giphy attachment UI should render within the message list with actions', async () => {
|
|
219
|
+
const user1 = generateUser();
|
|
220
|
+
const attachment = generateGiphyAttachment();
|
|
221
|
+
attachment.actions = [
|
|
222
|
+
{ name: 'image_action', text: 'Send', value: 'send' },
|
|
223
|
+
{ name: 'image_action', text: 'Shuffle', value: 'shuffle' },
|
|
224
|
+
{
|
|
225
|
+
name: 'image_action',
|
|
226
|
+
text: 'Cancel',
|
|
227
|
+
value: 'cancel',
|
|
228
|
+
},
|
|
229
|
+
];
|
|
230
|
+
const mockedChannel = generateChannelResponse({
|
|
231
|
+
members: [generateMember({ user: user1 })],
|
|
232
|
+
messages: [
|
|
233
|
+
generateMessage({ user: user1 }),
|
|
234
|
+
generateMessage({ type: 'system', user: undefined }),
|
|
235
|
+
generateMessage({ attachments: [{ ...attachment }], user: user1 }),
|
|
236
|
+
],
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
const chatClient = await getTestClientWithUser({ id: 'testID' });
|
|
240
|
+
useMockedApis(chatClient, [getOrCreateChannelApi(mockedChannel)]);
|
|
241
|
+
const channel = chatClient.channel('messaging', mockedChannel.id);
|
|
242
|
+
await channel.watch();
|
|
243
|
+
|
|
244
|
+
const { getByTestId, queryByTestId } = render(
|
|
245
|
+
<OverlayProvider>
|
|
246
|
+
<Chat client={chatClient}>
|
|
247
|
+
<Channel channel={channel}>
|
|
248
|
+
<MessageList />
|
|
249
|
+
</Channel>
|
|
250
|
+
</Chat>
|
|
251
|
+
</OverlayProvider>,
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
expect(queryByTestId('giphy-action-attachment')).toBeTruthy();
|
|
255
|
+
expect(getByTestId('cancel-action-button')).toBeTruthy();
|
|
256
|
+
expect(getByTestId('shuffle-action-button')).toBeTruthy();
|
|
257
|
+
expect(getByTestId('send-action-button')).toBeTruthy();
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
it('giphy attachment UI should render within the message list', async () => {
|
|
261
|
+
const user1 = generateUser();
|
|
262
|
+
const attachment = generateGiphyAttachment();
|
|
263
|
+
|
|
264
|
+
const mockedChannel = generateChannelResponse({
|
|
265
|
+
members: [generateMember({ user: user1 })],
|
|
266
|
+
messages: [
|
|
267
|
+
generateMessage({ user: user1 }),
|
|
268
|
+
generateMessage({ type: 'system', user: undefined }),
|
|
269
|
+
generateMessage({ attachments: [{ ...attachment }], user: user1 }),
|
|
270
|
+
],
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
const chatClient = await getTestClientWithUser({ id: 'testID' });
|
|
274
|
+
useMockedApis(chatClient, [getOrCreateChannelApi(mockedChannel)]);
|
|
275
|
+
const channel = chatClient.channel('messaging', mockedChannel.id);
|
|
276
|
+
await channel.watch();
|
|
277
|
+
|
|
278
|
+
const { queryByTestId } = render(
|
|
279
|
+
<OverlayProvider>
|
|
280
|
+
<Chat client={chatClient}>
|
|
281
|
+
<Channel channel={channel}>
|
|
282
|
+
<MessageList />
|
|
283
|
+
</Channel>
|
|
284
|
+
</Chat>
|
|
285
|
+
</OverlayProvider>,
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
expect(queryByTestId('giphy-attachment')).toBeTruthy();
|
|
289
|
+
});
|
|
290
|
+
});
|
|
@@ -132,25 +132,25 @@ export type AttachmentPickerProps = {
|
|
|
132
132
|
/**
|
|
133
133
|
* Custom UI component to render [draggable handle](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/1.png) of attachment picker.
|
|
134
134
|
*
|
|
135
|
-
* **Default** [AttachmentPickerBottomSheetHandle](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle.tsx)
|
|
135
|
+
* **Default** [AttachmentPickerBottomSheetHandle](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle.tsx)
|
|
136
136
|
*/
|
|
137
137
|
AttachmentPickerBottomSheetHandle: React.FC<BottomSheetHandleProps>;
|
|
138
138
|
/**
|
|
139
139
|
* Custom UI component to render error component while opening attachment picker.
|
|
140
140
|
*
|
|
141
|
-
* **Default** [AttachmentPickerError](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/AttachmentPickerError.tsx)
|
|
141
|
+
* **Default** [AttachmentPickerError](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/AttachmentPickerError.tsx)
|
|
142
142
|
*/
|
|
143
143
|
AttachmentPickerError: React.ComponentType<AttachmentPickerErrorProps>;
|
|
144
144
|
/**
|
|
145
145
|
* Custom UI component to render error image for attachment picker
|
|
146
146
|
*
|
|
147
|
-
* **Default** [AttachmentPickerErrorImage](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/AttachmentPickerErrorImage.tsx)
|
|
147
|
+
* **Default** [AttachmentPickerErrorImage](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/AttachmentPickerErrorImage.tsx)
|
|
148
148
|
*/
|
|
149
149
|
AttachmentPickerErrorImage: React.ComponentType;
|
|
150
150
|
/**
|
|
151
151
|
* Custom UI component to render overlay component, that shows up on top of [selected image](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/1.png) (with tick mark)
|
|
152
152
|
*
|
|
153
|
-
* **Default** [ImageOverlaySelectedComponent](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/ImageOverlaySelectedComponent.tsx)
|
|
153
|
+
* **Default** [ImageOverlaySelectedComponent](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/ImageOverlaySelectedComponent.tsx)
|
|
154
154
|
*/
|
|
155
155
|
ImageOverlaySelectedComponent: React.ComponentType;
|
|
156
156
|
attachmentPickerBottomSheetHandleHeight?: number;
|
|
@@ -304,7 +304,7 @@ export type ChannelPropsWithContext<
|
|
|
304
304
|
/**
|
|
305
305
|
* When true, disables the KeyboardCompatibleView wrapper
|
|
306
306
|
*
|
|
307
|
-
* Channel internally uses the [KeyboardCompatibleView](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx)
|
|
307
|
+
* Channel internally uses the [KeyboardCompatibleView](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx)
|
|
308
308
|
* component to adjust the height of Channel when the keyboard is opened or dismissed. This prop provides the ability to disable this functionality in case you
|
|
309
309
|
* want to use [KeyboardAvoidingView](https://facebook.github.io/react-native/docs/keyboardavoidingview) or handle dismissal yourself.
|
|
310
310
|
* KeyboardAvoidingView works well when your component occupies 100% of screen height, otherwise it may raise some issues.
|
|
@@ -345,7 +345,7 @@ export type ChannelPropsWithContext<
|
|
|
345
345
|
keyboardBehavior?: KeyboardAvoidingViewProps['behavior'];
|
|
346
346
|
/**
|
|
347
347
|
* Custom wrapper component that handles height adjustment of Channel component when keyboard is opened or dismissed
|
|
348
|
-
* Default component (accepts the same props): [KeyboardCompatibleView](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx)
|
|
348
|
+
* Default component (accepts the same props): [KeyboardCompatibleView](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx)
|
|
349
349
|
*
|
|
350
350
|
* **Example:**
|
|
351
351
|
*
|
|
@@ -18,7 +18,7 @@ import { Channel } from '../../Channel/Channel';
|
|
|
18
18
|
import { Chat } from '../../Chat/Chat';
|
|
19
19
|
import { MessageList } from '../../MessageList/MessageList';
|
|
20
20
|
|
|
21
|
-
describe('
|
|
21
|
+
describe('isAttachmentEqualHandler', () => {
|
|
22
22
|
let channel;
|
|
23
23
|
let chatClient;
|
|
24
24
|
|
|
@@ -5,6 +5,7 @@ import Dayjs from 'dayjs';
|
|
|
5
5
|
|
|
6
6
|
import type { Channel } from 'stream-chat';
|
|
7
7
|
|
|
8
|
+
import { useAppSettings } from './hooks/useAppSettings';
|
|
8
9
|
import { useCreateChatContext } from './hooks/useCreateChatContext';
|
|
9
10
|
import { useIsOnline } from './hooks/useIsOnline';
|
|
10
11
|
import { useMutedUsers } from './hooks/useMutedUsers';
|
|
@@ -90,7 +91,7 @@ export type ChatProps<
|
|
|
90
91
|
*/
|
|
91
92
|
i18nInstance?: Streami18n;
|
|
92
93
|
/**
|
|
93
|
-
* You can pass the theme object to customize the styles of Chat components. You can check the default theme in [theme.ts](https://github.com/GetStream/stream-chat-react-native/blob/master/src/contexts/themeContext/utils/theme.ts)
|
|
94
|
+
* You can pass the theme object to customize the styles of Chat components. You can check the default theme in [theme.ts](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/contexts/themeContext/utils/theme.ts)
|
|
94
95
|
*
|
|
95
96
|
* Please check section about [themes in cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#theme) for details.
|
|
96
97
|
*
|
|
@@ -161,7 +162,10 @@ const ChatWithContext = <
|
|
|
161
162
|
|
|
162
163
|
const setActiveChannel = (newChannel?: Channel<StreamChatGenerics>) => setChannel(newChannel);
|
|
163
164
|
|
|
165
|
+
const appSettings = useAppSettings(client, isOnline);
|
|
166
|
+
|
|
164
167
|
const chatContext = useCreateChatContext({
|
|
168
|
+
appSettings,
|
|
165
169
|
channel,
|
|
166
170
|
client,
|
|
167
171
|
connectionRecovering,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { render, waitFor } from '@testing-library/react-native';
|
|
5
|
+
|
|
6
|
+
import type { StreamChat } from 'stream-chat';
|
|
7
|
+
|
|
8
|
+
import { useAppSettings } from '../useAppSettings';
|
|
9
|
+
|
|
10
|
+
describe('useAppSettings', () => {
|
|
11
|
+
it('will return a settings object if the backend call is successful', async () => {
|
|
12
|
+
const TestComponent = () => {
|
|
13
|
+
const isOnline = true;
|
|
14
|
+
const appSettings = useAppSettings(
|
|
15
|
+
{
|
|
16
|
+
getAppSettings: jest.fn().mockReturnValue(
|
|
17
|
+
Promise.resolve({
|
|
18
|
+
auto_translation_enabled: true,
|
|
19
|
+
}),
|
|
20
|
+
),
|
|
21
|
+
} as unknown as StreamChat,
|
|
22
|
+
isOnline,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return <Text>{JSON.stringify(appSettings)}</Text>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const { getByText } = render(<TestComponent />);
|
|
29
|
+
|
|
30
|
+
await waitFor(() => {
|
|
31
|
+
expect(getByText(JSON.stringify({ auto_translation_enabled: true }))).toBeTruthy();
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { AppSettingsAPIResponse, StreamChat } from 'stream-chat';
|
|
4
|
+
import type { DefaultStreamChatGenerics } from 'stream-chat-react-native';
|
|
5
|
+
|
|
6
|
+
export const useAppSettings = <
|
|
7
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
8
|
+
>(
|
|
9
|
+
client: StreamChat<StreamChatGenerics>,
|
|
10
|
+
isOnline: boolean,
|
|
11
|
+
): AppSettingsAPIResponse | null => {
|
|
12
|
+
const [appSettings, setAppSettings] = useState<AppSettingsAPIResponse | null>(null);
|
|
13
|
+
const isMounted = useRef(true);
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
async function getAppSettings() {
|
|
17
|
+
try {
|
|
18
|
+
const appSettings = await client.getAppSettings();
|
|
19
|
+
if (isMounted.current) {
|
|
20
|
+
setAppSettings(appSettings);
|
|
21
|
+
}
|
|
22
|
+
} catch (error: unknown) {
|
|
23
|
+
if (error instanceof Error) {
|
|
24
|
+
console.error(`An error occurred while getting app settings: ${error}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (isOnline) {
|
|
30
|
+
getAppSettings();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return () => {
|
|
34
|
+
isMounted.current = false;
|
|
35
|
+
};
|
|
36
|
+
}, [client, isOnline]);
|
|
37
|
+
|
|
38
|
+
return appSettings;
|
|
39
|
+
};
|
|
@@ -6,6 +6,7 @@ import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
|
6
6
|
export const useCreateChatContext = <
|
|
7
7
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
8
8
|
>({
|
|
9
|
+
appSettings,
|
|
9
10
|
channel,
|
|
10
11
|
client,
|
|
11
12
|
connectionRecovering,
|
|
@@ -21,6 +22,7 @@ export const useCreateChatContext = <
|
|
|
21
22
|
|
|
22
23
|
const chatContext: ChatContextValue<StreamChatGenerics> = useMemo(
|
|
23
24
|
() => ({
|
|
25
|
+
appSettings,
|
|
24
26
|
channel,
|
|
25
27
|
client,
|
|
26
28
|
connectionRecovering,
|
|
@@ -147,7 +147,7 @@ export type MessagePropsWithContext<
|
|
|
147
147
|
* You can call methods available on the Message
|
|
148
148
|
* component such as handleEdit, handleDelete, handleAction etc.
|
|
149
149
|
*
|
|
150
|
-
* Source - [Message](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/Message.tsx)
|
|
150
|
+
* Source - [Message](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Message/Message.tsx)
|
|
151
151
|
*
|
|
152
152
|
* By default, we show the overlay with all the message actions on long press.
|
|
153
153
|
*
|
|
@@ -160,7 +160,7 @@ export type MessagePropsWithContext<
|
|
|
160
160
|
* You can call methods available on the Message
|
|
161
161
|
* component such as handleEdit, handleDelete, handleAction etc.
|
|
162
162
|
*
|
|
163
|
-
* Source - [Message](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/Message.tsx)
|
|
163
|
+
* Source - [Message](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Message/Message.tsx)
|
|
164
164
|
*
|
|
165
165
|
* By default, we will dismiss the keyboard on press.
|
|
166
166
|
*
|
|
@@ -445,23 +445,22 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
445
445
|
const prevMessageAttachments = prevMessage.attachments;
|
|
446
446
|
const nextMessageAttachments = nextMessage.attachments;
|
|
447
447
|
const attachmentsEqual =
|
|
448
|
-
Array.isArray(prevMessageAttachments) &&
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
});
|
|
448
|
+
Array.isArray(prevMessageAttachments) && Array.isArray(nextMessageAttachments)
|
|
449
|
+
? prevMessageAttachments.length === nextMessageAttachments.length &&
|
|
450
|
+
prevMessageAttachments.every((attachment, index) => {
|
|
451
|
+
const attachmentKeysEqual =
|
|
452
|
+
attachment.image_url === nextMessageAttachments[index].image_url &&
|
|
453
|
+
attachment.og_scrape_url === nextMessageAttachments[index].og_scrape_url &&
|
|
454
|
+
attachment.thumb_url === nextMessageAttachments[index].thumb_url;
|
|
455
|
+
|
|
456
|
+
if (isAttachmentEqual)
|
|
457
|
+
return (
|
|
458
|
+
attachmentKeysEqual && !!isAttachmentEqual(attachment, nextMessageAttachments[index])
|
|
459
|
+
);
|
|
460
|
+
|
|
461
|
+
return attachmentKeysEqual;
|
|
462
|
+
})
|
|
463
|
+
: prevMessageAttachments === nextMessageAttachments;
|
|
465
464
|
if (!attachmentsEqual) return false;
|
|
466
465
|
|
|
467
466
|
const latestReactionsEqual =
|
|
@@ -147,18 +147,17 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
147
147
|
const prevMessageAttachments = prevMessage.attachments;
|
|
148
148
|
const nextMessageAttachments = nextMessage.attachments;
|
|
149
149
|
const attachmentsEqual =
|
|
150
|
-
Array.isArray(prevMessageAttachments) &&
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
});
|
|
150
|
+
Array.isArray(prevMessageAttachments) && Array.isArray(nextMessageAttachments)
|
|
151
|
+
? prevMessageAttachments.length === nextMessageAttachments.length &&
|
|
152
|
+
prevMessageAttachments.every((attachment, index) => {
|
|
153
|
+
const attachmentKeysEqual =
|
|
154
|
+
attachment.image_url === nextMessageAttachments[index].image_url &&
|
|
155
|
+
attachment.og_scrape_url === nextMessageAttachments[index].og_scrape_url &&
|
|
156
|
+
attachment.thumb_url === nextMessageAttachments[index].thumb_url;
|
|
157
|
+
|
|
158
|
+
return attachmentKeysEqual;
|
|
159
|
+
})
|
|
160
|
+
: prevMessageAttachments === nextMessageAttachments;
|
|
162
161
|
if (!attachmentsEqual) return false;
|
|
163
162
|
|
|
164
163
|
const latestReactionsEqual =
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[src/components/Message/MessageSimple/utils/renderText.ts](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/MessageSimple/utils/renderText.ts)
|
|
1
|
+
[src/components/Message/MessageSimple/utils/renderText.ts](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Message/MessageSimple/utils/renderText.ts)
|
|
2
2
|
|
|
3
3
|
Function that handles markdown and parsing for the text of message.
|
|
4
4
|
|
|
@@ -21,20 +21,20 @@ export type AttachmentPickerContextValue = {
|
|
|
21
21
|
/**
|
|
22
22
|
* Custom UI component for [camera selector icon](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/1.png)
|
|
23
23
|
*
|
|
24
|
-
* **Default: ** [CameraSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/CameraSelectorIcon.tsx)
|
|
24
|
+
* **Default: ** [CameraSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/CameraSelectorIcon.tsx)
|
|
25
25
|
*/
|
|
26
26
|
CameraSelectorIcon: React.ComponentType<AttachmentPickerIconProps>;
|
|
27
27
|
closePicker: () => void;
|
|
28
28
|
/**
|
|
29
29
|
* Custom UI component for [file selector icon](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/1.png)
|
|
30
30
|
*
|
|
31
|
-
* **Default: ** [FileSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/FileSelectorIcon.tsx)
|
|
31
|
+
* **Default: ** [FileSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/FileSelectorIcon.tsx)
|
|
32
32
|
*/
|
|
33
33
|
FileSelectorIcon: React.ComponentType<AttachmentPickerIconProps>;
|
|
34
34
|
/**
|
|
35
35
|
* Custom UI component for [image selector icon](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/1.png)
|
|
36
36
|
*
|
|
37
|
-
* **Default: ** [ImageSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentPicker/components/ImageSelectorIcon.tsx)
|
|
37
|
+
* **Default: ** [ImageSelectorIcon](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/AttachmentPicker/components/ImageSelectorIcon.tsx)
|
|
38
38
|
*/
|
|
39
39
|
ImageSelectorIcon: React.ComponentType<AttachmentPickerIconProps>;
|
|
40
40
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Please check the `ChannelContextValue` in [ChannelContext](https://github.com/GetStream/stream-chat-react-native/blob/master/src/contexts/channelContext/ChannelContext.md), for consumable values.
|
|
1
|
+
Please check the `ChannelContextValue` in [ChannelContext](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/contexts/channelContext/ChannelContext.md), for consumable values.
|
|
2
2
|
Provider for this context exists in `Channel` component. And so, any child component of Channel
|
|
3
3
|
can get access to context as following:
|
|
4
4
|
|
|
@@ -34,4 +34,4 @@ class SomeChildComponent extends React.Component {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export withChannelContext(SomeChildComponent);
|
|
37
|
-
```
|
|
37
|
+
```
|
|
@@ -36,7 +36,7 @@ export type ChannelContextValue<
|
|
|
36
36
|
/**
|
|
37
37
|
* Custom UI component to display empty state when channel has no messages.
|
|
38
38
|
*
|
|
39
|
-
* **Default** [EmptyStateIndicator](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Indicators/EmptyStateIndicator.tsx)
|
|
39
|
+
* **Default** [EmptyStateIndicator](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/Indicators/EmptyStateIndicator.tsx)
|
|
40
40
|
*/
|
|
41
41
|
EmptyStateIndicator: React.ComponentType<EmptyStateProps>;
|
|
42
42
|
/**
|
|
@@ -155,7 +155,7 @@ export type ChannelContextValue<
|
|
|
155
155
|
/**
|
|
156
156
|
* Custom UI component for sticky header of channel.
|
|
157
157
|
*
|
|
158
|
-
* **Default** [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageList/DateHeader.tsx)
|
|
158
|
+
* **Default** [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/components/MessageList/DateHeader.tsx)
|
|
159
159
|
*/
|
|
160
160
|
StickyHeader?: React.ComponentType<{ dateString: string }>;
|
|
161
161
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Please check the `ChannelsContextValue` in [ChannelsContext](https://github.com/GetStream/stream-chat-react-native/blob/master/src/contexts/channelsContext/ChannelsContext.md), for consumable values.
|
|
1
|
+
Please check the `ChannelsContextValue` in [ChannelsContext](https://github.com/GetStream/stream-chat-react-native/blob/master/package/src/contexts/channelsContext/ChannelsContext.md), for consumable values.
|
|
2
2
|
Provider for this context exists in `ChannelList` component. And so, any child component of ChannelList
|
|
3
3
|
can get access to context as following:
|
|
4
4
|
|
|
@@ -35,4 +35,4 @@ class SomeChildComponent extends React.Component {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export withChannelsContext(SomeChildComponent);
|
|
38
|
-
```
|
|
38
|
+
```
|