From ba7c31c4e7ad1d1fcffd89f74bc1ea78f68f0651 Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Sat, 12 Feb 2022 19:14:02 +0100 Subject: [PATCH] Show full image when only 1 --- src/components/Timeline/Shared/Attachment/Image.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/Timeline/Shared/Attachment/Image.tsx b/src/components/Timeline/Shared/Attachment/Image.tsx index 1b99e7fe..1a0960cb 100644 --- a/src/components/Timeline/Shared/Attachment/Image.tsx +++ b/src/components/Timeline/Shared/Attachment/Image.tsx @@ -28,7 +28,17 @@ const AttachmentImage = React.memo( uri={{ original: image.preview_url, remote: image.remote_url }} blurhash={image.blurhash} onPress={onPress} - style={[{ aspectRatio: attachmentAspectRatio({ total, index }) }]} + style={[ + { + aspectRatio: + total > 1 || + !image.meta?.original?.width || + !image.meta?.original?.height || + image.meta.original.width / image.meta.original.height > 2 + ? attachmentAspectRatio({ total, index }) + : image.meta.original.width / image.meta.original.height + } + ]} /> )