workletize a function that wasn't getting autoworkletized anymore (#8309)

This commit is contained in:
Samuel Newman
2025-05-01 07:32:08 +03:00
committed by GitHub
parent 7fa71d8d8b
commit 4f9be71dee
+10 -8
View File
@@ -510,20 +510,22 @@ function LightboxImage({
// This is a bug in Reanimated, but for now we'll work around it like this. // This is a bug in Reanimated, but for now we'll work around it like this.
dismissSwipeTranslateY.set(1) dismissSwipeTranslateY.set(1)
} }
dismissSwipeTranslateY.set(() => dismissSwipeTranslateY.set(() => {
withDecay({ 'worklet'
return withDecay({
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.
}), })
) })
} else { } else {
dismissSwipeTranslateY.set(() => dismissSwipeTranslateY.set(() => {
withSpring(0, { 'worklet'
return withSpring(0, {
stiffness: 700, stiffness: 700,
damping: 50, damping: 50,
}), })
) })
} }
}) })