11import React from 'react' ;
2- import { FlatList , Image , StyleSheet , Text , TouchableOpacity , View } from 'react-native' ;
2+ import {
3+ FlatList ,
4+ Image ,
5+ StyleSheet ,
6+ Text ,
7+ TouchableOpacity ,
8+ TouchableOpacityProps ,
9+ View ,
10+ } from 'react-native' ;
311
412import { UploadProgressIndicator } from './UploadProgressIndicator' ;
513
@@ -87,9 +95,8 @@ const ImageUploadPreviewWithContext = <
8795
8896 const {
8997 theme : {
90- colors : { overlay, white } ,
9198 messageInput : {
92- imageUploadPreview : { dismiss , flatList, itemContainer, upload } ,
99+ imageUploadPreview : { flatList, itemContainer, upload } ,
93100 } ,
94101 } ,
95102 } = useTheme ( ) ;
@@ -140,15 +147,11 @@ const ImageUploadPreviewWithContext = <
140147 style = { [ styles . upload , upload ] }
141148 />
142149 </ UploadProgressIndicator >
143- < TouchableOpacity
150+ < DismissUpload
144151 onPress = { ( ) => {
145152 removeImage ( item . id ) ;
146153 } }
147- style = { [ styles . dismiss , { backgroundColor : overlay } , dismiss ] }
148- testID = 'remove-image-upload-preview'
149- >
150- < Close pathFill = { white } />
151- </ TouchableOpacity >
154+ />
152155 < UnsupportedImageTypeIndicator indicatorType = { indicatorType } />
153156 </ View >
154157 ) ;
@@ -170,6 +173,29 @@ const ImageUploadPreviewWithContext = <
170173 ) : null ;
171174} ;
172175
176+ type DismissUploadProps = Pick < TouchableOpacityProps , 'onPress' > ;
177+
178+ const DismissUpload = ( { onPress } : DismissUploadProps ) => {
179+ const {
180+ theme : {
181+ colors : { overlay, white } ,
182+ messageInput : {
183+ imageUploadPreview : { dismiss, dismissIconColor } ,
184+ } ,
185+ } ,
186+ } = useTheme ( ) ;
187+
188+ return (
189+ < TouchableOpacity
190+ onPress = { onPress }
191+ style = { [ styles . dismiss , { backgroundColor : overlay } , dismiss ] }
192+ testID = 'remove-image-upload-preview'
193+ >
194+ < Close pathFill = { dismissIconColor || white } />
195+ </ TouchableOpacity >
196+ ) ;
197+ } ;
198+
173199const areEqual = < StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics > (
174200 prevProps : ImageUploadPreviewPropsWithContext < StreamChatGenerics > ,
175201 nextProps : ImageUploadPreviewPropsWithContext < StreamChatGenerics > ,
0 commit comments