diff --git a/app/components/files/image_file.tsx b/app/components/files/image_file.tsx index f935fcc6e0..ac48ffd1f1 100644 --- a/app/components/files/image_file.tsx +++ b/app/components/files/image_file.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import React, {useCallback, useMemo, useState} from 'react'; -import {type StyleProp, StyleSheet, useWindowDimensions, View, type ViewStyle} from 'react-native'; +import {StyleSheet, useWindowDimensions, View} from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; import {buildFilePreviewUrl, buildFileThumbnailUrl} from '@actions/remote/file'; @@ -59,15 +59,6 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({ imagePreview: { ...StyleSheet.absoluteFillObject, }, - smallImageBorder: { - borderRadius: 5, - }, - smallImageOverlay: { - justifyContent: 'center', - alignItems: 'center', - borderRadius: 4, - position: 'absolute', - }, singleSmallImageWrapper: { height: SMALL_IMAGE_MAX_HEIGHT, width: SMALL_IMAGE_MAX_WIDTH, @@ -117,56 +108,9 @@ const ImageFile = ({ return props; }; - const imageDimensions = getImageDimensions(); - if (imageDimensions && (imageDimensions.height <= SMALL_IMAGE_MAX_HEIGHT || imageDimensions.width <= SMALL_IMAGE_MAX_WIDTH)) { - let wrapperStyle: StyleProp = style.fileImageWrapper; - if (isSingleImage) { - wrapperStyle = style.singleSmallImageWrapper; - - if (file.width > SMALL_IMAGE_MAX_WIDTH) { - wrapperStyle = [wrapperStyle, {width: '100%'}]; - } - } - - image = ( - - ); - - if (failed) { - image = ( - - ); - } - - return ( - - {!isSingleImage && } - - {image} - - - ); + let imageDimensions = getImageDimensions(); + if (isSingleImage && (!imageDimensions || (imageDimensions?.height === 0 && imageDimensions?.width === 0))) { + imageDimensions = style.singleSmallImageWrapper; } image = ( diff --git a/app/components/progressive_image/index.tsx b/app/components/progressive_image/index.tsx index 4d0279fa8e..e22c8ffd18 100644 --- a/app/components/progressive_image/index.tsx +++ b/app/components/progressive_image/index.tsx @@ -7,6 +7,7 @@ import FastImage, {type ResizeMode} from 'react-native-fast-image'; import Animated, {interpolate, useAnimatedStyle, useDerivedValue, useSharedValue, withTiming} from 'react-native-reanimated'; import {useTheme} from '@context/theme'; +import {emptyFunction} from '@utils/general'; import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; import Thumbnail from './thumbnail'; @@ -153,8 +154,9 @@ const ProgressiveImage = ({ + {Boolean(thumbnailUri) && + } {image} );