From 4f9be71deedc10ae6fb1281610542ed57857fc4e Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Thu, 1 May 2025 07:32:08 +0300 Subject: [PATCH] workletize a function that wasn't getting autoworkletized anymore (#8309) --- src/view/com/lightbox/ImageViewing/index.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/view/com/lightbox/ImageViewing/index.tsx b/src/view/com/lightbox/ImageViewing/index.tsx index 41a54eba66..bb3c39f594 100644 --- a/src/view/com/lightbox/ImageViewing/index.tsx +++ b/src/view/com/lightbox/ImageViewing/index.tsx @@ -510,20 +510,22 @@ function LightboxImage({ // This is a bug in Reanimated, but for now we'll work around it like this. dismissSwipeTranslateY.set(1) } - dismissSwipeTranslateY.set(() => - withDecay({ + dismissSwipeTranslateY.set(() => { + 'worklet' + return withDecay({ velocity: e.velocityY, 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. - }), - ) + }) + }) } else { - dismissSwipeTranslateY.set(() => - withSpring(0, { + dismissSwipeTranslateY.set(() => { + 'worklet' + return withSpring(0, { stiffness: 700, damping: 50, - }), - ) + }) + }) } })