about summary refs log tree commit diff
path: root/src/components/anim/AnimatedCheck.tsx
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-11-17 15:06:28 +0000
committerGitHub <noreply@github.com>2024-11-17 15:06:28 +0000
commit474c4eff29b6a2454a20febf78a1edd5cf58663a (patch)
tree43a189a8101cf3f5265d967ad46182cf8cbde9a0 /src/components/anim/AnimatedCheck.tsx
parentd575a2fdaaa4d9c93d6b739dfe3377cdd5985dc1 (diff)
downloadvoidsky-474c4eff29b6a2454a20febf78a1edd5cf58663a.tar.zst
Use compiler-safe Reanimated get/set APIs (#6391)
* Convert lightbox to get/set

* Work around software-mansion/react-native-reanimated#6613

* Use get/set in more places

* Port MainScrollProvider to get/set

* Port more to get/set

* Port composer to get/set

* Remove unnecessary thread hops in composer

* Port more things to get/set

* Convert more to get/set, remove redundant runOnJS

* Convert remaining cases to get/set
Diffstat (limited to 'src/components/anim/AnimatedCheck.tsx')
-rw-r--r--src/components/anim/AnimatedCheck.tsx20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/components/anim/AnimatedCheck.tsx b/src/components/anim/AnimatedCheck.tsx
index 7fdfc14cf..60407274e 100644
--- a/src/components/anim/AnimatedCheck.tsx
+++ b/src/components/anim/AnimatedCheck.tsx
@@ -32,21 +32,25 @@ export const AnimatedCheck = React.forwardRef<
   const checkAnim = useSharedValue(0)
 
   const circleAnimatedProps = useAnimatedProps(() => ({
-    strokeDashoffset: 166 - circleAnim.value * 166,
+    strokeDashoffset: 166 - circleAnim.get() * 166,
   }))
   const checkAnimatedProps = useAnimatedProps(() => ({
-    strokeDashoffset: 48 - 48 * checkAnim.value,
+    strokeDashoffset: 48 - 48 * checkAnim.get(),
   }))
 
   const play = React.useCallback(
     (cb?: () => void) => {
-      circleAnim.value = 0
-      checkAnim.value = 0
+      circleAnim.set(0)
+      checkAnim.set(0)
 
-      circleAnim.value = withTiming(1, {duration: 500, easing: Easing.linear})
-      checkAnim.value = withDelay(
-        500,
-        withTiming(1, {duration: 300, easing: Easing.linear}, cb),
+      circleAnim.set(() =>
+        withTiming(1, {duration: 500, easing: Easing.linear}),
+      )
+      checkAnim.set(() =>
+        withDelay(
+          500,
+          withTiming(1, {duration: 300, easing: Easing.linear}, cb),
+        ),
       )
     },
     [circleAnim, checkAnim],