stream-chat-react-native-core 4.2.0-beta.3 → 4.2.0-beta.4
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 +37 -28
- package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Giphy.js +37 -28
- package/lib/module/components/Attachment/Giphy.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Giphy.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Attachment/Giphy.tsx +19 -6
- package/src/components/Message/MessageSimple/MessageContent.tsx +1 -1
- package/src/version.json +1 -1
|
@@ -109,7 +109,7 @@ export type GiphyPropsWithContext<
|
|
|
109
109
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
110
110
|
> = Pick<
|
|
111
111
|
MessageContextValue<StreamChatGenerics>,
|
|
112
|
-
'handleAction' | 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'
|
|
112
|
+
'handleAction' | 'isMyMessage' | 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'
|
|
113
113
|
> &
|
|
114
114
|
Pick<MessagesContextValue<StreamChatGenerics>, 'giphyVersion' | 'additionalTouchableProps'> & {
|
|
115
115
|
attachment: Attachment<StreamChatGenerics>;
|
|
@@ -124,6 +124,7 @@ const GiphyWithContext = <
|
|
|
124
124
|
additionalTouchableProps,
|
|
125
125
|
attachment,
|
|
126
126
|
handleAction,
|
|
127
|
+
isMyMessage,
|
|
127
128
|
onLongPress,
|
|
128
129
|
onPress,
|
|
129
130
|
onPressIn,
|
|
@@ -262,7 +263,13 @@ const GiphyWithContext = <
|
|
|
262
263
|
testID='giphy-attachment'
|
|
263
264
|
{...additionalTouchableProps}
|
|
264
265
|
>
|
|
265
|
-
<View
|
|
266
|
+
<View
|
|
267
|
+
style={[
|
|
268
|
+
styles.container,
|
|
269
|
+
{ backgroundColor: isMyMessage ? grey_gainsboro : white },
|
|
270
|
+
container,
|
|
271
|
+
]}
|
|
272
|
+
>
|
|
266
273
|
<Image
|
|
267
274
|
resizeMode='contain'
|
|
268
275
|
source={{ uri: makeImageCompatibleUrl(uri) }}
|
|
@@ -295,10 +302,12 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
295
302
|
const {
|
|
296
303
|
attachment: { actions: prevActions, image_url: prevImageUrl, thumb_url: prevThumbUrl },
|
|
297
304
|
giphyVersion: prevGiphyVersion,
|
|
305
|
+
isMyMessage: prevIsMyMessage,
|
|
298
306
|
} = prevProps;
|
|
299
307
|
const {
|
|
300
308
|
attachment: { actions: nextActions, image_url: nextImageUrl, thumb_url: nextThumbUrl },
|
|
301
309
|
giphyVersion: nextGiphyVersion,
|
|
310
|
+
isMyMessage: nextIsMyMessage,
|
|
302
311
|
} = nextProps;
|
|
303
312
|
|
|
304
313
|
const imageUrlEqual = prevImageUrl === nextImageUrl;
|
|
@@ -307,9 +316,6 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
307
316
|
const thumbUrlEqual = prevThumbUrl === nextThumbUrl;
|
|
308
317
|
if (!thumbUrlEqual) return false;
|
|
309
318
|
|
|
310
|
-
const giphyVersionEqual = prevGiphyVersion === nextGiphyVersion;
|
|
311
|
-
if (!giphyVersionEqual) return false;
|
|
312
|
-
|
|
313
319
|
const actionsEqual =
|
|
314
320
|
Array.isArray(prevActions) === Array.isArray(nextActions) &&
|
|
315
321
|
((Array.isArray(prevActions) &&
|
|
@@ -318,6 +324,12 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
318
324
|
prevActions === nextActions);
|
|
319
325
|
if (!actionsEqual) return false;
|
|
320
326
|
|
|
327
|
+
const giphyVersionEqual = prevGiphyVersion === nextGiphyVersion;
|
|
328
|
+
if (!giphyVersionEqual) return false;
|
|
329
|
+
|
|
330
|
+
const isMyMessageEqual = prevIsMyMessage === nextIsMyMessage;
|
|
331
|
+
if (!isMyMessageEqual) return false;
|
|
332
|
+
|
|
321
333
|
return true;
|
|
322
334
|
};
|
|
323
335
|
|
|
@@ -340,7 +352,7 @@ export const Giphy = <
|
|
|
340
352
|
>(
|
|
341
353
|
props: GiphyProps<StreamChatGenerics>,
|
|
342
354
|
) => {
|
|
343
|
-
const { handleAction, onLongPress, onPress, onPressIn, preventPress } =
|
|
355
|
+
const { handleAction, isMyMessage, onLongPress, onPress, onPressIn, preventPress } =
|
|
344
356
|
useMessageContext<StreamChatGenerics>();
|
|
345
357
|
const { additionalTouchableProps, giphyVersion } = useMessagesContext<StreamChatGenerics>();
|
|
346
358
|
|
|
@@ -350,6 +362,7 @@ export const Giphy = <
|
|
|
350
362
|
additionalTouchableProps,
|
|
351
363
|
giphyVersion,
|
|
352
364
|
handleAction,
|
|
365
|
+
isMyMessage,
|
|
353
366
|
onLongPress,
|
|
354
367
|
onPress,
|
|
355
368
|
onPressIn,
|
|
@@ -212,7 +212,7 @@ const MessageContentWithContext = <
|
|
|
212
212
|
backgroundColor = transparent;
|
|
213
213
|
} else if (otherAttachments.length) {
|
|
214
214
|
if (otherAttachments[0].type === 'giphy') {
|
|
215
|
-
backgroundColor = message.quoted_message
|
|
215
|
+
backgroundColor = message.quoted_message ? grey_gainsboro : transparent;
|
|
216
216
|
} else {
|
|
217
217
|
backgroundColor = blue_alice;
|
|
218
218
|
}
|
package/src/version.json
CHANGED