Skip to content

Commit b77752d

Browse files
authored
fix: stop the loading state of the image when image fails to load (#3264)
1 parent ae4d258 commit b77752d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

package/src/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ export const ImageAttachmentUploadPreview = ({
4949
setLoading(false);
5050
}, []);
5151

52+
const onErrorHandler = useCallback(() => {
53+
setLoading(false);
54+
}, []);
55+
5256
return (
5357
<View style={[styles.itemContainer, itemContainer]} testID={'image-attachment-upload-preview'}>
5458
<AttachmentUploadProgressIndicator
@@ -57,6 +61,7 @@ export const ImageAttachmentUploadPreview = ({
5761
type={indicatorType}
5862
>
5963
<Image
64+
onError={onErrorHandler}
6065
onLoadEnd={onLoadEndHandler}
6166
resizeMode='cover'
6267
source={{ uri: attachment.localMetadata.previewUri ?? attachment.image_url }}

0 commit comments

Comments
 (0)