Override Reduce Motion on load-bearing animation (#9294)

This commit is contained in:
Samuel Newman
2025-10-28 18:52:31 +02:00
parent f1803068ae
commit fa98a66755
@@ -18,6 +18,7 @@ import Animated, {
cancelAnimation, cancelAnimation,
interpolate, interpolate,
measure, measure,
ReduceMotion,
runOnJS, runOnJS,
type SharedValue, type SharedValue,
useAnimatedReaction, useAnimatedReaction,
@@ -516,6 +517,7 @@ function LightboxImage({
velocity: e.velocityY, velocity: e.velocityY,
velocityFactor: Math.max(3500 / Math.abs(e.velocityY), 1), // Speed up if it's too slow. velocityFactor: Math.max(3500 / Math.abs(e.velocityY), 1), // Speed up if it's too slow.
deceleration: 1, // Danger! This relies on the reaction below stopping it. deceleration: 1, // Danger! This relies on the reaction below stopping it.
reduceMotion: ReduceMotion.Never, // If this animation doesn't run, the image gets stuck - therefore override Reduce Motion
}) })
}) })
} else { } else {
@@ -524,6 +526,7 @@ function LightboxImage({
return withSpring(0, { return withSpring(0, {
stiffness: 700, stiffness: 700,
damping: 50, damping: 50,
reduceMotion: ReduceMotion.Never,
}) })
}) })
} }