stream-chat-react-native-core 5.2.0 → 5.3.0-beta.3
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/Card.js +29 -18
- package/lib/commonjs/components/Attachment/Card.js.map +1 -1
- package/lib/commonjs/components/Attachment/Gallery.js +16 -20
- package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
- package/lib/commonjs/components/Attachment/GalleryImage.js +34 -6
- package/lib/commonjs/components/Attachment/GalleryImage.js.map +1 -1
- package/lib/commonjs/components/Attachment/Giphy.js +37 -29
- package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
- package/lib/commonjs/components/Avatar/Avatar.js +10 -8
- package/lib/commonjs/components/Avatar/Avatar.js.map +1 -1
- package/lib/commonjs/components/Avatar/GroupAvatar.js +3 -1
- package/lib/commonjs/components/Avatar/GroupAvatar.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelList.js +4 -4
- package/lib/commonjs/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListMessenger.js +4 -4
- package/lib/commonjs/components/ChannelList/ChannelListMessenger.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/useCreateChannelsContext.js +1 -1
- package/lib/commonjs/components/ChannelList/hooks/useCreateChannelsContext.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +6 -7
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js +30 -6
- package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js.map +1 -1
- package/lib/commonjs/components/Chat/Chat.js +8 -5
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js +2 -0
- package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js.map +1 -1
- package/lib/commonjs/components/ImageBackground.js +64 -0
- package/lib/commonjs/components/ImageBackground.js.map +1 -0
- package/lib/commonjs/components/Message/Message.js +15 -16
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageAvatar.js +12 -4
- package/lib/commonjs/components/Message/MessageSimple/MessageAvatar.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageRepliesAvatars.js +26 -5
- package/lib/commonjs/components/Message/MessageSimple/MessageRepliesAvatars.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +58 -47
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/commonjs/contexts/chatContext/ChatContext.js +2 -2
- package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Card.js +29 -18
- package/lib/module/components/Attachment/Card.js.map +1 -1
- package/lib/module/components/Attachment/Gallery.js +16 -20
- package/lib/module/components/Attachment/Gallery.js.map +1 -1
- package/lib/module/components/Attachment/GalleryImage.js +34 -6
- package/lib/module/components/Attachment/GalleryImage.js.map +1 -1
- package/lib/module/components/Attachment/Giphy.js +37 -29
- package/lib/module/components/Attachment/Giphy.js.map +1 -1
- package/lib/module/components/Avatar/Avatar.js +10 -8
- package/lib/module/components/Avatar/Avatar.js.map +1 -1
- package/lib/module/components/Avatar/GroupAvatar.js +3 -1
- package/lib/module/components/Avatar/GroupAvatar.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelList.js +4 -4
- package/lib/module/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelListMessenger.js +4 -4
- package/lib/module/components/ChannelList/ChannelListMessenger.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/useCreateChannelsContext.js +1 -1
- package/lib/module/components/ChannelList/hooks/useCreateChannelsContext.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +6 -7
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelAvatar.js +30 -6
- package/lib/module/components/ChannelPreview/ChannelAvatar.js.map +1 -1
- package/lib/module/components/Chat/Chat.js +8 -5
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/Chat/hooks/useCreateChatContext.js +2 -0
- package/lib/module/components/Chat/hooks/useCreateChatContext.js.map +1 -1
- package/lib/module/components/ImageBackground.js +64 -0
- package/lib/module/components/ImageBackground.js.map +1 -0
- package/lib/module/components/Message/Message.js +15 -16
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageAvatar.js +12 -4
- package/lib/module/components/Message/MessageSimple/MessageAvatar.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageRepliesAvatars.js +26 -5
- package/lib/module/components/Message/MessageSimple/MessageRepliesAvatars.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageOverlay.js +58 -47
- package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/module/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/module/contexts/chatContext/ChatContext.js +2 -2
- package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/module/native.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Card.d.ts +3 -2
- package/lib/typescript/components/Attachment/GalleryImage.d.ts +8 -2
- package/lib/typescript/components/Attachment/Giphy.d.ts +2 -1
- package/lib/typescript/components/Avatar/Avatar.d.ts +2 -1
- package/lib/typescript/components/Avatar/GroupAvatar.d.ts +2 -1
- package/lib/typescript/components/ChannelList/hooks/usePaginatedChannels.d.ts +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelAvatar.d.ts +2 -0
- package/lib/typescript/components/Chat/Chat.d.ts +1 -1
- package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts +1 -1
- package/lib/typescript/components/ImageBackground.d.ts +33 -0
- package/lib/typescript/components/Message/Message.d.ts +2 -1
- package/lib/typescript/components/Message/MessageSimple/MessageAvatar.d.ts +2 -1
- package/lib/typescript/components/Message/MessageSimple/MessageRepliesAvatars.d.ts +2 -0
- package/lib/typescript/contexts/channelsContext/ChannelsContext.d.ts +1 -1
- package/lib/typescript/contexts/chatContext/ChatContext.d.ts +3 -1
- package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +4 -0
- package/lib/typescript/native.d.ts +2 -2
- package/package.json +1 -1
- package/src/__tests__/offline-feature.test.js +3 -1
- package/src/components/Attachment/Card.tsx +11 -2
- package/src/components/Attachment/Gallery.tsx +1 -7
- package/src/components/Attachment/GalleryImage.tsx +31 -9
- package/src/components/Attachment/Giphy.tsx +8 -2
- package/src/components/Avatar/Avatar.tsx +12 -2
- package/src/components/Avatar/GroupAvatar.tsx +4 -4
- package/src/components/ChannelList/ChannelList.tsx +3 -2
- package/src/components/ChannelList/ChannelListMessenger.tsx +3 -3
- package/src/components/ChannelList/__tests__/ChannelList.test.js +1 -1
- package/src/components/ChannelList/hooks/listeners/__tests__/useChannelUpdated.test.tsx +2 -1
- package/src/components/ChannelList/hooks/useCreateChannelsContext.ts +1 -1
- package/src/components/ChannelList/hooks/usePaginatedChannels.ts +12 -11
- package/src/components/ChannelPreview/ChannelAvatar.tsx +23 -4
- package/src/components/Chat/Chat.tsx +98 -95
- package/src/components/Chat/hooks/useCreateChatContext.ts +2 -0
- package/src/components/ImageBackground.tsx +77 -0
- package/src/components/Message/Message.tsx +8 -8
- package/src/components/Message/MessageSimple/MessageAvatar.tsx +6 -2
- package/src/components/Message/MessageSimple/MessageRepliesAvatars.tsx +15 -3
- package/src/components/MessageOverlay/MessageOverlay.tsx +210 -205
- package/src/contexts/channelsContext/ChannelsContext.tsx +1 -1
- package/src/contexts/chatContext/ChatContext.tsx +3 -1
- package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +8 -1
- package/src/native.ts +2 -2
- package/src/version.json +1 -1
|
@@ -118,7 +118,6 @@ export type MessagePropsWithContext<
|
|
|
118
118
|
ChannelContextValue<StreamChatGenerics>,
|
|
119
119
|
'channel' | 'disabled' | 'enforceUniqueReaction' | 'members'
|
|
120
120
|
> &
|
|
121
|
-
Pick<ChatContextValue<StreamChatGenerics>, 'client' | 'mutedUsers'> &
|
|
122
121
|
Pick<KeyboardContextValue, 'dismissKeyboard'> &
|
|
123
122
|
Partial<Omit<MessageContextValue<StreamChatGenerics>, 'groupStyles' | 'message'>> &
|
|
124
123
|
Pick<MessageContextValue<StreamChatGenerics>, 'groupStyles' | 'message'> &
|
|
@@ -157,6 +156,7 @@ export type MessagePropsWithContext<
|
|
|
157
156
|
Pick<OverlayContextValue, 'setOverlay'> &
|
|
158
157
|
Pick<ThreadContextValue<StreamChatGenerics>, 'openThread'> &
|
|
159
158
|
Pick<TranslationContextValue, 't'> & {
|
|
159
|
+
chatContext: ChatContextValue<StreamChatGenerics>;
|
|
160
160
|
messagesContext: MessagesContextValue<StreamChatGenerics>;
|
|
161
161
|
/**
|
|
162
162
|
* Whether or not users are able to long press messages.
|
|
@@ -218,7 +218,6 @@ const MessageWithContext = <
|
|
|
218
218
|
|
|
219
219
|
const {
|
|
220
220
|
channel,
|
|
221
|
-
client,
|
|
222
221
|
disabled,
|
|
223
222
|
dismissKeyboard,
|
|
224
223
|
dismissKeyboardOnMessageTouch,
|
|
@@ -238,6 +237,7 @@ const MessageWithContext = <
|
|
|
238
237
|
handleReaction: handleReactionProp,
|
|
239
238
|
handleRetry,
|
|
240
239
|
handleThreadReply,
|
|
240
|
+
chatContext,
|
|
241
241
|
lastReceivedId,
|
|
242
242
|
members,
|
|
243
243
|
message,
|
|
@@ -272,7 +272,7 @@ const MessageWithContext = <
|
|
|
272
272
|
threadList = false,
|
|
273
273
|
updateMessage,
|
|
274
274
|
} = props;
|
|
275
|
-
|
|
275
|
+
const { client } = chatContext;
|
|
276
276
|
const {
|
|
277
277
|
theme: {
|
|
278
278
|
colors: { bg_gradient_start, targetedMessageBackground },
|
|
@@ -547,6 +547,7 @@ const MessageWithContext = <
|
|
|
547
547
|
|
|
548
548
|
setData({
|
|
549
549
|
alignment,
|
|
550
|
+
chatContext,
|
|
550
551
|
clientId: client.userID,
|
|
551
552
|
files: attachments.files,
|
|
552
553
|
groupStyles,
|
|
@@ -719,23 +720,23 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
719
720
|
nextProps: MessagePropsWithContext<StreamChatGenerics>,
|
|
720
721
|
) => {
|
|
721
722
|
const {
|
|
723
|
+
chatContext: { mutedUsers: prevMutedUsers },
|
|
722
724
|
goToMessage: prevGoToMessage,
|
|
723
725
|
isAttachmentEqual,
|
|
724
726
|
isTargetedMessage: prevIsTargetedMessage,
|
|
725
727
|
lastReceivedId: prevLastReceivedId,
|
|
726
728
|
members: prevMembers,
|
|
727
729
|
message: prevMessage,
|
|
728
|
-
mutedUsers: prevMutedUsers,
|
|
729
730
|
showUnreadUnderlay: prevShowUnreadUnderlay,
|
|
730
731
|
t: prevT,
|
|
731
732
|
} = prevProps;
|
|
732
733
|
const {
|
|
734
|
+
chatContext: { mutedUsers: nextMutedUsers },
|
|
733
735
|
goToMessage: nextGoToMessage,
|
|
734
736
|
isTargetedMessage: nextIsTargetedMessage,
|
|
735
737
|
lastReceivedId: nextLastReceivedId,
|
|
736
738
|
members: nextMembers,
|
|
737
739
|
message: nextMessage,
|
|
738
|
-
mutedUsers: nextMutedUsers,
|
|
739
740
|
showUnreadUnderlay: nextShowUnreadUnderlay,
|
|
740
741
|
t: nextT,
|
|
741
742
|
} = nextProps;
|
|
@@ -857,7 +858,7 @@ export const Message = <
|
|
|
857
858
|
) => {
|
|
858
859
|
const { channel, disabled, enforceUniqueReaction, members } =
|
|
859
860
|
useChannelContext<StreamChatGenerics>();
|
|
860
|
-
const
|
|
861
|
+
const chatContext = useChatContext<StreamChatGenerics>();
|
|
861
862
|
const { dismissKeyboard } = useKeyboardContext();
|
|
862
863
|
const { setData } = useMessageOverlayContext<StreamChatGenerics>();
|
|
863
864
|
const messagesContext = useMessagesContext<StreamChatGenerics>();
|
|
@@ -870,13 +871,12 @@ export const Message = <
|
|
|
870
871
|
{...messagesContext}
|
|
871
872
|
{...{
|
|
872
873
|
channel,
|
|
873
|
-
|
|
874
|
+
chatContext,
|
|
874
875
|
disabled,
|
|
875
876
|
dismissKeyboard,
|
|
876
877
|
enforceUniqueReaction,
|
|
877
878
|
members,
|
|
878
879
|
messagesContext,
|
|
879
|
-
mutedUsers,
|
|
880
880
|
openThread,
|
|
881
881
|
setData,
|
|
882
882
|
setOverlay,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
|
|
4
|
+
import { ChatContextValue, useChatContext } from '../../../contexts/chatContext/ChatContext';
|
|
4
5
|
import {
|
|
5
6
|
MessageContextValue,
|
|
6
7
|
useMessageContext,
|
|
@@ -16,6 +17,7 @@ export type MessageAvatarPropsWithContext<
|
|
|
16
17
|
MessageContextValue<StreamChatGenerics>,
|
|
17
18
|
'alignment' | 'lastGroupMessage' | 'message' | 'showAvatar'
|
|
18
19
|
> &
|
|
20
|
+
Pick<ChatContextValue<StreamChatGenerics>, 'ImageComponent'> &
|
|
19
21
|
Partial<Pick<AvatarProps, 'size'>>;
|
|
20
22
|
|
|
21
23
|
const MessageAvatarWithContext = <
|
|
@@ -23,7 +25,7 @@ const MessageAvatarWithContext = <
|
|
|
23
25
|
>(
|
|
24
26
|
props: MessageAvatarPropsWithContext<StreamChatGenerics>,
|
|
25
27
|
) => {
|
|
26
|
-
const { alignment, lastGroupMessage, message, showAvatar, size } = props;
|
|
28
|
+
const { alignment, ImageComponent, lastGroupMessage, message, showAvatar, size } = props;
|
|
27
29
|
const {
|
|
28
30
|
theme: {
|
|
29
31
|
avatar: { BASE_AVATAR_SIZE },
|
|
@@ -43,6 +45,7 @@ const MessageAvatarWithContext = <
|
|
|
43
45
|
{visible ? (
|
|
44
46
|
<Avatar
|
|
45
47
|
image={message.user?.image}
|
|
48
|
+
ImageComponent={ImageComponent}
|
|
46
49
|
name={message.user?.name || message.user?.id}
|
|
47
50
|
size={size || BASE_AVATAR_SIZE}
|
|
48
51
|
/>
|
|
@@ -88,11 +91,12 @@ export const MessageAvatar = <
|
|
|
88
91
|
) => {
|
|
89
92
|
const { alignment, lastGroupMessage, message, showAvatar } =
|
|
90
93
|
useMessageContext<StreamChatGenerics>();
|
|
91
|
-
|
|
94
|
+
const { ImageComponent } = useChatContext<StreamChatGenerics>();
|
|
92
95
|
return (
|
|
93
96
|
<MemoizedMessageAvatar
|
|
94
97
|
{...{
|
|
95
98
|
alignment,
|
|
99
|
+
ImageComponent,
|
|
96
100
|
lastGroupMessage,
|
|
97
101
|
message,
|
|
98
102
|
showAvatar,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
|
|
4
|
+
import { ChatContextValue, useChatContext } from '../../../contexts/chatContext/ChatContext';
|
|
4
5
|
import type { MessageContextValue } from '../../../contexts/messageContext/MessageContext';
|
|
5
6
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
6
7
|
|
|
@@ -23,12 +24,12 @@ export type MessageRepliesAvatarsProps<
|
|
|
23
24
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
24
25
|
> = Pick<MessageContextValue<StreamChatGenerics>, 'alignment' | 'message'>;
|
|
25
26
|
|
|
26
|
-
export const
|
|
27
|
+
export const MessageRepliesAvatarsWithContext = <
|
|
27
28
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
28
29
|
>(
|
|
29
|
-
props: MessageRepliesAvatarsProps<StreamChatGenerics>,
|
|
30
|
+
props: MessageRepliesAvatarsProps<StreamChatGenerics> & Pick<ChatContextValue, 'ImageComponent'>,
|
|
30
31
|
) => {
|
|
31
|
-
const { alignment, message } = props;
|
|
32
|
+
const { alignment, ImageComponent, message } = props;
|
|
32
33
|
|
|
33
34
|
const {
|
|
34
35
|
theme: {
|
|
@@ -77,6 +78,7 @@ export const MessageRepliesAvatars = <
|
|
|
77
78
|
avatar,
|
|
78
79
|
]}
|
|
79
80
|
image={user.image}
|
|
81
|
+
ImageComponent={ImageComponent}
|
|
80
82
|
name={user.name}
|
|
81
83
|
size={avatarSize ? avatarSize : i === 1 ? 18 : 16}
|
|
82
84
|
/>
|
|
@@ -85,3 +87,13 @@ export const MessageRepliesAvatars = <
|
|
|
85
87
|
</View>
|
|
86
88
|
);
|
|
87
89
|
};
|
|
90
|
+
|
|
91
|
+
export const MessageRepliesAvatars = <
|
|
92
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
93
|
+
>(
|
|
94
|
+
props: MessageRepliesAvatarsProps<StreamChatGenerics>,
|
|
95
|
+
) => {
|
|
96
|
+
const { ImageComponent } = useChatContext();
|
|
97
|
+
|
|
98
|
+
return <MessageRepliesAvatarsWithContext {...props} ImageComponent={ImageComponent} />;
|
|
99
|
+
};
|
|
@@ -24,6 +24,7 @@ import { MessageActionList as DefaultMessageActionList } from './MessageActionLi
|
|
|
24
24
|
import { OverlayReactionList as OverlayReactionListDefault } from './OverlayReactionList';
|
|
25
25
|
import { OverlayReactionsAvatar as OverlayReactionsAvatarDefault } from './OverlayReactionsAvatar';
|
|
26
26
|
|
|
27
|
+
import { ChatProvider } from '../../contexts/chatContext/ChatContext';
|
|
27
28
|
import { MessageProvider } from '../../contexts/messageContext/MessageContext';
|
|
28
29
|
import {
|
|
29
30
|
MessageOverlayContextValue,
|
|
@@ -118,6 +119,7 @@ const MessageOverlayWithContext = <
|
|
|
118
119
|
groupStyles,
|
|
119
120
|
handleReaction,
|
|
120
121
|
images,
|
|
122
|
+
chatContext,
|
|
121
123
|
message,
|
|
122
124
|
messageActions,
|
|
123
125
|
MessageActionList = DefaultMessageActionList,
|
|
@@ -301,219 +303,222 @@ const MessageOverlayWithContext = <
|
|
|
301
303
|
const { Attachment, FileAttachmentGroup, Gallery, MessageAvatar, Reply } = messagesContext || {};
|
|
302
304
|
|
|
303
305
|
return (
|
|
304
|
-
<
|
|
305
|
-
<
|
|
306
|
-
<
|
|
307
|
-
<
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
<PanGestureHandler
|
|
312
|
-
enabled={overlay === 'message'}
|
|
313
|
-
maxPointers={1}
|
|
314
|
-
minDist={10}
|
|
315
|
-
onGestureEvent={onPan}
|
|
306
|
+
<ChatProvider value={chatContext}>
|
|
307
|
+
<MessagesProvider value={messagesContext}>
|
|
308
|
+
<MessageProvider value={messageContext}>
|
|
309
|
+
<ThemeProvider mergedStyle={wrapMessageInTheme ? modifiedTheme : theme}>
|
|
310
|
+
<Animated.View
|
|
311
|
+
pointerEvents={'auto'}
|
|
312
|
+
style={[StyleSheet.absoluteFillObject, containerStyle]}
|
|
316
313
|
>
|
|
317
|
-
<
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
showScreen={showScreen}
|
|
344
|
-
/>
|
|
345
|
-
) : null}
|
|
346
|
-
<Animated.View
|
|
347
|
-
onLayout={({
|
|
348
|
-
nativeEvent: {
|
|
349
|
-
layout: { height: layoutHeight, width: layoutWidth, x, y },
|
|
350
|
-
},
|
|
351
|
-
}) => {
|
|
352
|
-
messageLayout.value = {
|
|
353
|
-
x: alignment === 'left' ? x + layoutWidth : x,
|
|
354
|
-
y,
|
|
355
|
-
};
|
|
356
|
-
messageWidth.value = layoutWidth;
|
|
357
|
-
messageHeight.value = layoutHeight;
|
|
358
|
-
}}
|
|
359
|
-
style={[styles.alignEnd, styles.row, showScreenStyle]}
|
|
314
|
+
<PanGestureHandler
|
|
315
|
+
enabled={overlay === 'message'}
|
|
316
|
+
maxPointers={1}
|
|
317
|
+
minDist={10}
|
|
318
|
+
onGestureEvent={onPan}
|
|
319
|
+
>
|
|
320
|
+
<Animated.View style={[StyleSheet.absoluteFillObject]}>
|
|
321
|
+
<SafeAreaView style={styles.flex}>
|
|
322
|
+
<TapGestureHandler
|
|
323
|
+
maxDist={32}
|
|
324
|
+
onHandlerStateChange={({ nativeEvent: { state } }) => {
|
|
325
|
+
if (state === State.END) {
|
|
326
|
+
setOverlay('none');
|
|
327
|
+
}
|
|
328
|
+
}}
|
|
329
|
+
>
|
|
330
|
+
<Animated.View style={[styles.flex, panStyle]}>
|
|
331
|
+
{message && (
|
|
332
|
+
<View
|
|
333
|
+
style={[
|
|
334
|
+
styles.center,
|
|
335
|
+
styles.overlayPadding,
|
|
336
|
+
{ padding: overlayPadding },
|
|
337
|
+
alignment === 'left' ? styles.alignStart : styles.alignEnd,
|
|
338
|
+
]}
|
|
360
339
|
>
|
|
361
|
-
{
|
|
362
|
-
<
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
? !message.quoted_message
|
|
375
|
-
? transparent
|
|
376
|
-
: grey_gainsboro
|
|
377
|
-
: blue_alice
|
|
378
|
-
: alignment === 'left'
|
|
379
|
-
? white_smoke
|
|
380
|
-
: grey_gainsboro,
|
|
381
|
-
borderBottomLeftRadius:
|
|
382
|
-
(groupStyle === 'left_bottom' ||
|
|
383
|
-
groupStyle === 'left_single') &&
|
|
384
|
-
(!hasThreadReplies || threadList)
|
|
385
|
-
? borderRadiusS
|
|
386
|
-
: borderRadiusL,
|
|
387
|
-
borderBottomRightRadius:
|
|
388
|
-
(groupStyle === 'right_bottom' ||
|
|
389
|
-
groupStyle === 'right_single') &&
|
|
390
|
-
(!hasThreadReplies || threadList)
|
|
391
|
-
? borderRadiusS
|
|
392
|
-
: borderRadiusL,
|
|
393
|
-
borderColor: grey_whisper,
|
|
340
|
+
{handleReaction && ownCapabilities?.sendReaction ? (
|
|
341
|
+
<OverlayReactionList
|
|
342
|
+
messageLayout={messageLayout}
|
|
343
|
+
ownReactionTypes={
|
|
344
|
+
message?.own_reactions?.map((reaction) => reaction.type) || []
|
|
345
|
+
}
|
|
346
|
+
showScreen={showScreen}
|
|
347
|
+
/>
|
|
348
|
+
) : null}
|
|
349
|
+
<Animated.View
|
|
350
|
+
onLayout={({
|
|
351
|
+
nativeEvent: {
|
|
352
|
+
layout: { height: layoutHeight, width: layoutWidth, x, y },
|
|
394
353
|
},
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
:
|
|
398
|
-
|
|
399
|
-
|
|
354
|
+
}) => {
|
|
355
|
+
messageLayout.value = {
|
|
356
|
+
x: alignment === 'left' ? x + layoutWidth : x,
|
|
357
|
+
y,
|
|
358
|
+
};
|
|
359
|
+
messageWidth.value = layoutWidth;
|
|
360
|
+
messageHeight.value = layoutHeight;
|
|
361
|
+
}}
|
|
362
|
+
style={[styles.alignEnd, styles.row, showScreenStyle]}
|
|
400
363
|
>
|
|
401
|
-
{
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
364
|
+
{alignment === 'left' && MessageAvatar && (
|
|
365
|
+
<MessageAvatar {...{ alignment, message, showAvatar: true }} />
|
|
366
|
+
)}
|
|
367
|
+
<View
|
|
368
|
+
pointerEvents='none'
|
|
369
|
+
style={[
|
|
370
|
+
styles.containerInner,
|
|
371
|
+
{
|
|
372
|
+
backgroundColor:
|
|
373
|
+
onlyEmojis && !message.quoted_message
|
|
374
|
+
? transparent
|
|
375
|
+
: otherAttachments?.length
|
|
376
|
+
? otherAttachments[0].type === 'giphy'
|
|
377
|
+
? !message.quoted_message
|
|
378
|
+
? transparent
|
|
379
|
+
: grey_gainsboro
|
|
380
|
+
: blue_alice
|
|
381
|
+
: alignment === 'left'
|
|
382
|
+
? white_smoke
|
|
383
|
+
: grey_gainsboro,
|
|
384
|
+
borderBottomLeftRadius:
|
|
385
|
+
(groupStyle === 'left_bottom' ||
|
|
386
|
+
groupStyle === 'left_single') &&
|
|
387
|
+
(!hasThreadReplies || threadList)
|
|
388
|
+
? borderRadiusS
|
|
389
|
+
: borderRadiusL,
|
|
390
|
+
borderBottomRightRadius:
|
|
391
|
+
(groupStyle === 'right_bottom' ||
|
|
392
|
+
groupStyle === 'right_single') &&
|
|
393
|
+
(!hasThreadReplies || threadList)
|
|
394
|
+
? borderRadiusS
|
|
395
|
+
: borderRadiusL,
|
|
396
|
+
borderColor: grey_whisper,
|
|
397
|
+
},
|
|
398
|
+
(onlyEmojis && !message.quoted_message) ||
|
|
399
|
+
otherAttachments?.length
|
|
400
|
+
? { borderWidth: 0 }
|
|
401
|
+
: {},
|
|
402
|
+
containerInner,
|
|
403
|
+
]}
|
|
404
|
+
>
|
|
405
|
+
{messagesContext?.messageContentOrder?.map(
|
|
406
|
+
(messageContentType, messageContentOrderIndex) => {
|
|
407
|
+
switch (messageContentType) {
|
|
408
|
+
case 'quoted_reply':
|
|
409
|
+
return (
|
|
410
|
+
message.quoted_message &&
|
|
411
|
+
Reply && (
|
|
412
|
+
<View
|
|
413
|
+
key={`quoted_reply_${messageContentOrderIndex}`}
|
|
414
|
+
style={[styles.replyContainer, replyContainer]}
|
|
415
|
+
>
|
|
416
|
+
<Reply
|
|
417
|
+
quotedMessage={
|
|
418
|
+
message.quoted_message as ReplyProps<StreamChatGenerics>['quotedMessage']
|
|
419
|
+
}
|
|
420
|
+
styles={{
|
|
421
|
+
messageContainer: {
|
|
422
|
+
maxWidth: vw(60),
|
|
423
|
+
},
|
|
424
|
+
}}
|
|
425
|
+
/>
|
|
426
|
+
</View>
|
|
427
|
+
)
|
|
428
|
+
);
|
|
429
|
+
case 'attachments':
|
|
430
|
+
return otherAttachments?.map(
|
|
431
|
+
(attachment, attachmentIndex) =>
|
|
432
|
+
Attachment && (
|
|
433
|
+
<Attachment
|
|
434
|
+
attachment={attachment}
|
|
435
|
+
key={`${message.id}-${attachmentIndex}`}
|
|
436
|
+
/>
|
|
437
|
+
),
|
|
438
|
+
);
|
|
439
|
+
case 'files':
|
|
440
|
+
return (
|
|
441
|
+
FileAttachmentGroup && (
|
|
442
|
+
<FileAttachmentGroup
|
|
443
|
+
files={files}
|
|
444
|
+
key={`file_attachment_group_${messageContentOrderIndex}`}
|
|
445
|
+
messageId={message.id}
|
|
421
446
|
/>
|
|
422
|
-
|
|
423
|
-
)
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
447
|
+
)
|
|
448
|
+
);
|
|
449
|
+
case 'gallery':
|
|
450
|
+
return (
|
|
451
|
+
Gallery && (
|
|
452
|
+
<Gallery
|
|
453
|
+
alignment={alignment}
|
|
454
|
+
groupStyles={groupStyles}
|
|
455
|
+
hasThreadReplies={!!message?.reply_count}
|
|
456
|
+
images={images}
|
|
457
|
+
key={`gallery_${messageContentOrderIndex}`}
|
|
458
|
+
message={message}
|
|
459
|
+
threadList={threadList}
|
|
460
|
+
videos={videos}
|
|
432
461
|
/>
|
|
433
|
-
)
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
key={`
|
|
441
|
-
messageId={message.id}
|
|
442
|
-
/>
|
|
443
|
-
)
|
|
444
|
-
);
|
|
445
|
-
case 'gallery':
|
|
446
|
-
return (
|
|
447
|
-
Gallery && (
|
|
448
|
-
<Gallery
|
|
449
|
-
alignment={alignment}
|
|
450
|
-
groupStyles={groupStyles}
|
|
451
|
-
hasThreadReplies={!!message?.reply_count}
|
|
452
|
-
images={images}
|
|
453
|
-
key={`gallery_${messageContentOrderIndex}`}
|
|
462
|
+
)
|
|
463
|
+
);
|
|
464
|
+
case 'text':
|
|
465
|
+
default:
|
|
466
|
+
return otherAttachments?.length &&
|
|
467
|
+
otherAttachments[0].actions ? null : (
|
|
468
|
+
<MessageTextContainer<StreamChatGenerics>
|
|
469
|
+
key={`message_text_container_${messageContentOrderIndex}`}
|
|
454
470
|
message={message}
|
|
455
|
-
|
|
456
|
-
|
|
471
|
+
messageOverlay
|
|
472
|
+
messageTextNumberOfLines={messageTextNumberOfLines}
|
|
473
|
+
onlyEmojis={onlyEmojis}
|
|
457
474
|
/>
|
|
458
|
-
)
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
) : null}
|
|
506
|
-
</View>
|
|
507
|
-
)}
|
|
508
|
-
</Animated.View>
|
|
509
|
-
</TapGestureHandler>
|
|
510
|
-
</SafeAreaView>
|
|
511
|
-
</Animated.View>
|
|
512
|
-
</PanGestureHandler>
|
|
513
|
-
</Animated.View>
|
|
514
|
-
</ThemeProvider>
|
|
515
|
-
</MessageProvider>
|
|
516
|
-
</MessagesProvider>
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
)}
|
|
479
|
+
</View>
|
|
480
|
+
</Animated.View>
|
|
481
|
+
{messageActions && (
|
|
482
|
+
<MessageActionList
|
|
483
|
+
MessageActionListItem={MessageActionListItem}
|
|
484
|
+
showScreen={showScreen}
|
|
485
|
+
{...messageActionProps}
|
|
486
|
+
message={message}
|
|
487
|
+
/>
|
|
488
|
+
)}
|
|
489
|
+
{!!messageReactionTitle &&
|
|
490
|
+
message.latest_reactions &&
|
|
491
|
+
message.latest_reactions.length > 0 ? (
|
|
492
|
+
<OverlayReactions
|
|
493
|
+
alignment={alignment}
|
|
494
|
+
OverlayReactionsAvatar={OverlayReactionsAvatar}
|
|
495
|
+
reactions={
|
|
496
|
+
message.latest_reactions.map((reaction) => ({
|
|
497
|
+
alignment:
|
|
498
|
+
clientId && clientId === reaction.user?.id ? 'right' : 'left',
|
|
499
|
+
id: reaction?.user?.id || '',
|
|
500
|
+
image: reaction?.user?.image,
|
|
501
|
+
name: reaction?.user?.name || reaction.user_id || '',
|
|
502
|
+
type: reaction.type,
|
|
503
|
+
})) as Reaction[]
|
|
504
|
+
}
|
|
505
|
+
showScreen={showScreen}
|
|
506
|
+
supportedReactions={messagesContext?.supportedReactions}
|
|
507
|
+
title={messageReactionTitle}
|
|
508
|
+
/>
|
|
509
|
+
) : null}
|
|
510
|
+
</View>
|
|
511
|
+
)}
|
|
512
|
+
</Animated.View>
|
|
513
|
+
</TapGestureHandler>
|
|
514
|
+
</SafeAreaView>
|
|
515
|
+
</Animated.View>
|
|
516
|
+
</PanGestureHandler>
|
|
517
|
+
</Animated.View>
|
|
518
|
+
</ThemeProvider>
|
|
519
|
+
</MessageProvider>
|
|
520
|
+
</MessagesProvider>
|
|
521
|
+
</ChatProvider>
|
|
517
522
|
);
|
|
518
523
|
};
|
|
519
524
|
|
|
@@ -48,7 +48,7 @@ export type ChannelsContextValue<
|
|
|
48
48
|
/**
|
|
49
49
|
* Channels can be either an array of channels or a promise which resolves to an array of channels
|
|
50
50
|
*/
|
|
51
|
-
channels: Channel<StreamChatGenerics>[];
|
|
51
|
+
channels: Channel<StreamChatGenerics>[] | null;
|
|
52
52
|
/**
|
|
53
53
|
* Custom indicator to use when channel list is empty
|
|
54
54
|
*
|