Force zoom out before close

It's too hard to make closing while zoomed out work.
This commit is contained in:
Dan Abramov
2024-11-03 03:05:04 +00:00
parent bed486f508
commit caeb86a368
2 changed files with 24 additions and 1 deletions
@@ -236,6 +236,13 @@ const ImageItem = ({
const singleTap = Gesture.Tap().onEnd(() => {
'worklet'
const [, , committedScale] = readTransform(committedTransform.value)
if (committedScale !== 1) {
// Go back to 1:1 using the identity vector.
let t = createTransform()
committedTransform.value = withClampedSpring(t)
return
}
runOnJS(onTap)()
})