11import React , { PropsWithChildren } from 'react' ;
22import ReactPlayer from 'react-player' ;
3- import { nanoid } from 'nanoid' ;
43
54import { AttachmentActions as DefaultAttachmentActions } from './AttachmentActions' ;
65import { Audio as DefaultAudio } from './Audio' ;
@@ -100,9 +99,6 @@ export const renderAttachmentWithinContainer = <
10099 className = { `str-chat__message-attachment str-chat__message-attachment--${ componentType } str-chat__message-attachment--${
101100 attachment ?. type || ''
102101 } str-chat__message-attachment--${ componentType } --${ extra } `}
103- key = { `${ isGalleryAttachmentType ( attachment ) ? '' : attachment ?. id || nanoid ( ) } -${
104- attachment ?. type || 'none'
105- } `}
106102 >
107103 { children }
108104 </ div >
@@ -124,7 +120,6 @@ export const renderAttachmentActions = <
124120 actionHandler = { ( event , name , value ) => actionHandler ?.( event , name , value ) }
125121 actions = { attachment . actions }
126122 id = { attachment . id || '' }
127- key = { `key-actions-${ attachment . id } ` }
128123 text = { attachment . text || '' }
129124 />
130125 ) ;
@@ -139,7 +134,7 @@ export const renderGallery = <
139134
140135 return renderAttachmentWithinContainer ( {
141136 attachment,
142- children : < Gallery images = { attachment . images || [ ] } key = 'gallery' /> ,
137+ children : < Gallery images = { attachment . images || [ ] } /> ,
143138 componentType : 'gallery' ,
144139 } ) ;
145140} ;
@@ -155,7 +150,7 @@ export const renderImage = <
155150 return renderAttachmentWithinContainer ( {
156151 attachment,
157152 children : (
158- < div className = 'str-chat__attachment' key = { `key-image- ${ attachment . id } ` } >
153+ < div className = 'str-chat__attachment' >
159154 { < Image { ...attachment } /> }
160155 { renderAttachmentActions ( props ) }
161156 </ div >
@@ -166,7 +161,7 @@ export const renderImage = <
166161
167162 return renderAttachmentWithinContainer ( {
168163 attachment,
169- children : < Image { ...attachment } key = { `key-image- ${ attachment . id } ` } /> ,
164+ children : < Image { ...attachment } /> ,
170165 componentType : 'image' ,
171166 } ) ;
172167} ;
@@ -182,8 +177,8 @@ export const renderCard = <
182177 return renderAttachmentWithinContainer ( {
183178 attachment,
184179 children : (
185- < div className = 'str-chat__attachment' key = { `key-image- ${ attachment . id } ` } >
186- < Card { ...attachment } key = { `key-card- ${ attachment . id } ` } />
180+ < div className = 'str-chat__attachment' >
181+ < Card { ...attachment } />
187182 { renderAttachmentActions ( props ) }
188183 </ div >
189184 ) ,
@@ -193,7 +188,7 @@ export const renderCard = <
193188
194189 return renderAttachmentWithinContainer ( {
195190 attachment,
196- children : < Card { ...attachment } key = { `key-card- ${ attachment . id } ` } /> ,
191+ children : < Card { ...attachment } /> ,
197192 componentType : 'card' ,
198193 } ) ;
199194} ;
@@ -209,7 +204,7 @@ export const renderFile = <
209204
210205 return renderAttachmentWithinContainer ( {
211206 attachment,
212- children : < File attachment = { attachment } key = { `key-file- ${ attachment . id } ` } /> ,
207+ children : < File attachment = { attachment } /> ,
213208 componentType : 'file' ,
214209 } ) ;
215210} ;
@@ -224,7 +219,7 @@ export const renderAudio = <
224219 return renderAttachmentWithinContainer ( {
225220 attachment,
226221 children : (
227- < div className = 'str-chat__attachment' key = { `key-video- ${ attachment . id } ` } >
222+ < div className = 'str-chat__attachment' >
228223 < Audio og = { attachment } />
229224 </ div >
230225 ) ,
@@ -243,10 +238,7 @@ export const renderMedia = <
243238 return renderAttachmentWithinContainer ( {
244239 attachment,
245240 children : (
246- < div
247- className = 'str-chat__attachment str-chat__attachment-media'
248- key = { `key-video-${ attachment . id } ` }
249- >
241+ < div className = 'str-chat__attachment str-chat__attachment-media' >
250242 < div className = 'str-chat__player-wrapper' >
251243 < Media
252244 className = 'react-player'
@@ -266,7 +258,7 @@ export const renderMedia = <
266258 return renderAttachmentWithinContainer ( {
267259 attachment,
268260 children : (
269- < div className = 'str-chat__player-wrapper' key = { `key-video- ${ attachment . id } ` } >
261+ < div className = 'str-chat__player-wrapper' >
270262 < Media
271263 className = 'react-player'
272264 controls
0 commit comments