diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-09-27 09:08:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-27 09:08:21 -0700 |
commit | d87c232660f215608c26280f4cfbd5af3948f9d1 (patch) | |
tree | fc5ac5782e48128650293d92e83ae41b8c4a9c03 /src/view/com/util/post-embeds/index.tsx | |
parent | 6325eff938495b88a3808aef3c772e9fe93d5550 (diff) | |
download | voidsky-d87c232660f215608c26280f4cfbd5af3948f9d1.tar.zst |
Improve image cropping on android and introduce aspect ratio field (#1525)
* Fix image cropping on android * Store and use aspect ratio field in post images (close #1392)
Diffstat (limited to 'src/view/com/util/post-embeds/index.tsx')
-rw-r--r-- | src/view/com/util/post-embeds/index.tsx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/view/com/util/post-embeds/index.tsx b/src/view/com/util/post-embeds/index.tsx index ce6da4a1b..2d79eed8f 100644 --- a/src/view/com/util/post-embeds/index.tsx +++ b/src/view/com/util/post-embeds/index.tsx @@ -93,7 +93,11 @@ export function PostEmbeds({ const {images} = embed if (images.length > 0) { - const items = embed.images.map(img => ({uri: img.fullsize, alt: img.alt})) + const items = embed.images.map(img => ({ + uri: img.fullsize, + alt: img.alt, + aspectRatio: img.aspectRatio, + })) const openLightbox = (index: number) => { store.shell.openLightbox(new ImagesLightbox(items, index)) } @@ -104,12 +108,13 @@ export function PostEmbeds({ } if (images.length === 1) { - const {alt, thumb} = images[0] + const {alt, thumb, aspectRatio} = images[0] return ( <View style={[styles.imagesContainer, style]}> <AutoSizedImage alt={alt} uri={thumb} + dimensionsHint={aspectRatio} onPress={() => openLightbox(0)} onPressIn={() => onPressIn(0)} style={[ |