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)
This commit is contained in:
Paul Frazee 2023-09-27 09:08:21 -07:00 committed by GitHub
parent 6325eff938
commit d87c232660
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 7 deletions

View file

@ -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={[