File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed
package/src/components/Message Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,8 @@ import type { Thumbnail } from '../Attachment/utils/buildGallery/types';
7272import { dismissKeyboard } from '../KeyboardCompatibleView/KeyboardControllerAvoidingView' ;
7373import { BottomSheetModal } from '../UIComponents' ;
7474
75- const createMessageOverlayId = ( ) => `message-overlay-${ generateRandomId ( ) } ` ;
75+ const createMessageOverlayId = ( messageId ?: string ) =>
76+ `message-overlay-${ messageId ?? 'unknown' } -${ generateRandomId ( ) } ` ;
7677
7778export type TouchableEmitter =
7879 | 'failed-image'
@@ -328,15 +329,7 @@ const MessageWithContext = (props: MessagePropsWithContext) => {
328329 ( ) => isMessageAIGenerated ( message ) ,
329330 [ message , isMessageAIGenerated ] ,
330331 ) ;
331- const messageOverlayIdRef = useRef ( createMessageOverlayId ( ) ) ;
332- const previousMessageIdRef = useRef ( message . id ) ;
333-
334- if ( previousMessageIdRef . current !== message . id ) {
335- previousMessageIdRef . current = message . id ;
336- messageOverlayIdRef . current = createMessageOverlayId ( ) ;
337- }
338-
339- const messageOverlayId = messageOverlayIdRef . current ;
332+ const messageOverlayId = useMemo ( ( ) => createMessageOverlayId ( message . id ) , [ message . id ] ) ;
340333 const isMessageTypeDeleted = message . type === 'deleted' ;
341334 const { client } = chatContext ;
342335
You can’t perform that action at this time.
0 commit comments