fix android carousel jiggle from cdn-rounded aspect ratio

This commit is contained in:
vineyardbovines
2026-07-14 13:17:07 -04:00
parent 9fa5f15baa
commit b0146a741d
+9 -1
View File
@@ -485,10 +485,18 @@ function GalleryImage({
loading={index === 0 ? 'eager' : 'lazy'} loading={index === 0 ? 'eager' : 'lazy'}
style={[dims]} style={[dims]}
onLoad={e => { onLoad={e => {
/*
* Only sync from the loaded thumb if we don't already have a
* ratio from the record. The CDN scales thumbs to integer pixel
* dims, so its reported ratio drifts a fraction from the
* record's - re-syncing would jiggle the FlatList item widths.
*/
if (aspectRatio === undefined) {
const ar = getAspectRatio(e.source) const ar = getAspectRatio(e.source)
if (ar && ar !== aspectRatio) { if (ar !== undefined) {
setAspectRatio(ar) setAspectRatio(ar)
} }
}
onThumbDims(index, { onThumbDims(index, {
width: e.source.width, width: e.source.width,
height: e.source.height, height: e.source.height,