fix android carousel jiggle from cdn-rounded aspect ratio (#11153)
This commit is contained in:
@@ -485,9 +485,17 @@ function GalleryImage({
|
|||||||
loading={index === 0 ? 'eager' : 'lazy'}
|
loading={index === 0 ? 'eager' : 'lazy'}
|
||||||
style={[dims]}
|
style={[dims]}
|
||||||
onLoad={e => {
|
onLoad={e => {
|
||||||
const ar = getAspectRatio(e.source)
|
/*
|
||||||
if (ar && ar !== aspectRatio) {
|
* Only sync from the loaded thumb if we don't already have a
|
||||||
setAspectRatio(ar)
|
* 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)
|
||||||
|
if (ar !== undefined) {
|
||||||
|
setAspectRatio(ar)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onThumbDims(index, {
|
onThumbDims(index, {
|
||||||
width: e.source.width,
|
width: e.source.width,
|
||||||
|
|||||||
Reference in New Issue
Block a user