@@ -109,7 +109,7 @@ export type GiphyPropsWithContext<
109109 StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
110110> = Pick <
111111 MessageContextValue < StreamChatGenerics > ,
112- 'handleAction' | 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'
112+ 'handleAction' | 'isMyMessage' | ' onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'
113113> &
114114 Pick < MessagesContextValue < StreamChatGenerics > , 'giphyVersion' | 'additionalTouchableProps' > & {
115115 attachment : Attachment < StreamChatGenerics > ;
@@ -124,6 +124,7 @@ const GiphyWithContext = <
124124 additionalTouchableProps,
125125 attachment,
126126 handleAction,
127+ isMyMessage,
127128 onLongPress,
128129 onPress,
129130 onPressIn,
@@ -262,7 +263,13 @@ const GiphyWithContext = <
262263 testID = 'giphy-attachment'
263264 { ...additionalTouchableProps }
264265 >
265- < View style = { [ styles . container , container ] } >
266+ < View
267+ style = { [
268+ styles . container ,
269+ { backgroundColor : isMyMessage ? grey_gainsboro : white } ,
270+ container ,
271+ ] }
272+ >
266273 < Image
267274 resizeMode = 'contain'
268275 source = { { uri : makeImageCompatibleUrl ( uri ) } }
@@ -295,10 +302,12 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
295302 const {
296303 attachment : { actions : prevActions , image_url : prevImageUrl , thumb_url : prevThumbUrl } ,
297304 giphyVersion : prevGiphyVersion ,
305+ isMyMessage : prevIsMyMessage ,
298306 } = prevProps ;
299307 const {
300308 attachment : { actions : nextActions , image_url : nextImageUrl , thumb_url : nextThumbUrl } ,
301309 giphyVersion : nextGiphyVersion ,
310+ isMyMessage : nextIsMyMessage ,
302311 } = nextProps ;
303312
304313 const imageUrlEqual = prevImageUrl === nextImageUrl ;
@@ -307,9 +316,6 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
307316 const thumbUrlEqual = prevThumbUrl === nextThumbUrl ;
308317 if ( ! thumbUrlEqual ) return false ;
309318
310- const giphyVersionEqual = prevGiphyVersion === nextGiphyVersion ;
311- if ( ! giphyVersionEqual ) return false ;
312-
313319 const actionsEqual =
314320 Array . isArray ( prevActions ) === Array . isArray ( nextActions ) &&
315321 ( ( Array . isArray ( prevActions ) &&
@@ -318,6 +324,12 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
318324 prevActions === nextActions ) ;
319325 if ( ! actionsEqual ) return false ;
320326
327+ const giphyVersionEqual = prevGiphyVersion === nextGiphyVersion ;
328+ if ( ! giphyVersionEqual ) return false ;
329+
330+ const isMyMessageEqual = prevIsMyMessage === nextIsMyMessage ;
331+ if ( ! isMyMessageEqual ) return false ;
332+
321333 return true ;
322334} ;
323335
@@ -340,7 +352,7 @@ export const Giphy = <
340352> (
341353 props : GiphyProps < StreamChatGenerics > ,
342354) => {
343- const { handleAction, onLongPress, onPress, onPressIn, preventPress } =
355+ const { handleAction, isMyMessage , onLongPress, onPress, onPressIn, preventPress } =
344356 useMessageContext < StreamChatGenerics > ( ) ;
345357 const { additionalTouchableProps, giphyVersion } = useMessagesContext < StreamChatGenerics > ( ) ;
346358
@@ -350,6 +362,7 @@ export const Giphy = <
350362 additionalTouchableProps,
351363 giphyVersion,
352364 handleAction,
365+ isMyMessage,
353366 onLongPress,
354367 onPress,
355368 onPressIn,
0 commit comments