stream-chat-react-native-core 4.13.0 → 4.14.0-beta.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/Attachment/utils/getGiphyMimeType.js +15 -0
- package/lib/commonjs/components/Attachment/utils/getGiphyMimeType.js.map +1 -0
- package/lib/commonjs/components/ChannelList/hooks/listeners/useNewMessage.js +16 -4
- package/lib/commonjs/components/ChannelList/hooks/listeners/useNewMessage.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +23 -21
- package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageTextContainer.js +7 -3
- package/lib/commonjs/components/Message/MessageSimple/MessageTextContainer.js.map +1 -1
- package/lib/commonjs/mock-builders/event/messageNew.js +2 -0
- package/lib/commonjs/mock-builders/event/messageNew.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/utils/getGiphyMimeType.js +15 -0
- package/lib/module/components/Attachment/utils/getGiphyMimeType.js.map +1 -0
- package/lib/module/components/ChannelList/hooks/listeners/useNewMessage.js +16 -4
- package/lib/module/components/ChannelList/hooks/listeners/useNewMessage.js.map +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +23 -21
- package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageTextContainer.js +7 -3
- package/lib/module/components/Message/MessageSimple/MessageTextContainer.js.map +1 -1
- package/lib/module/mock-builders/event/messageNew.js +2 -0
- package/lib/module/mock-builders/event/messageNew.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/utils/getGiphyMimeType.d.ts +6 -0
- package/package.json +1 -1
- package/src/components/Attachment/utils/getGiphyMimeType.ts +13 -0
- package/src/components/ChannelList/__tests__/ChannelList.test.js +28 -0
- package/src/components/ChannelList/hooks/listeners/useNewMessage.ts +19 -5
- package/src/components/ImageGallery/ImageGallery.tsx +2 -1
- package/src/components/Message/MessageSimple/MessageTextContainer.tsx +22 -2
- package/src/mock-builders/event/messageNew.js +2 -0
- package/src/version.json +1 -1
|
@@ -65,6 +65,7 @@ import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
|
65
65
|
import { getResizedImageUrl } from '../../utils/getResizedImageUrl';
|
|
66
66
|
import { getUrlOfImageAttachment } from '../../utils/getUrlOfImageAttachment';
|
|
67
67
|
import { vh, vw } from '../../utils/utils';
|
|
68
|
+
import { getGiphyMimeType } from '../Attachment/utils/getGiphyMimeType';
|
|
68
69
|
|
|
69
70
|
const isAndroid = Platform.OS === 'android';
|
|
70
71
|
const fullScreenHeight = Dimensions.get('screen').height;
|
|
@@ -280,7 +281,7 @@ export const ImageGallery = <
|
|
|
280
281
|
created_at: cur.created_at,
|
|
281
282
|
id: `photoId-${cur.id}-${imageUrl}`,
|
|
282
283
|
messageId: cur.id,
|
|
283
|
-
mime_type: a.type === 'giphy' ? '
|
|
284
|
+
mime_type: a.type === 'giphy' ? getGiphyMimeType(giphyURL ?? '') : a.mime_type,
|
|
284
285
|
original_height: a.original_height,
|
|
285
286
|
original_width: a.original_width,
|
|
286
287
|
type: a.type,
|
|
@@ -117,8 +117,16 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
117
117
|
prevProps: MessageTextContainerPropsWithContext<StreamChatGenerics>,
|
|
118
118
|
nextProps: MessageTextContainerPropsWithContext<StreamChatGenerics>,
|
|
119
119
|
) => {
|
|
120
|
-
const {
|
|
121
|
-
|
|
120
|
+
const {
|
|
121
|
+
markdownStyles: prevMarkdownStyles,
|
|
122
|
+
message: prevMessage,
|
|
123
|
+
onlyEmojis: prevOnlyEmojis,
|
|
124
|
+
} = prevProps;
|
|
125
|
+
const {
|
|
126
|
+
markdownStyles: nextMarkdownStyles,
|
|
127
|
+
message: nextMessage,
|
|
128
|
+
onlyEmojis: nextOnlyEmojis,
|
|
129
|
+
} = nextProps;
|
|
122
130
|
|
|
123
131
|
const messageTextEqual = prevMessage.text === nextMessage.text;
|
|
124
132
|
if (!messageTextEqual) return false;
|
|
@@ -134,6 +142,18 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
134
142
|
prevMessage.mentioned_users[0].name === nextMessage.mentioned_users[0].name));
|
|
135
143
|
if (!mentionedUsersEqual) return false;
|
|
136
144
|
|
|
145
|
+
// stringify could be an expensive operation, so lets rule out the obvious
|
|
146
|
+
// possibilities first such as different object reference or empty objects etc.
|
|
147
|
+
// Also keeping markdown equality check at the last to make sure other less
|
|
148
|
+
// expensive equality checks get executed first and markdown check will be skipped if returned
|
|
149
|
+
// false from previous checks.
|
|
150
|
+
const markdownStylesEqual =
|
|
151
|
+
prevMarkdownStyles === nextMarkdownStyles ||
|
|
152
|
+
(Object.keys(prevMarkdownStyles || {}).length === 0 &&
|
|
153
|
+
Object.keys(nextMarkdownStyles || {}).length === 0) ||
|
|
154
|
+
JSON.stringify(prevMarkdownStyles) === JSON.stringify(nextMarkdownStyles);
|
|
155
|
+
if (!markdownStylesEqual) return false;
|
|
156
|
+
|
|
137
157
|
return true;
|
|
138
158
|
};
|
|
139
159
|
|
package/src/version.json
CHANGED