From 72f46ed7349f5044d7b89fc8c7f5414b0805a67b Mon Sep 17 00:00:00 2001
From: Hailey <me@haileyok.com>
Date: Thu, 6 Jun 2024 06:28:02 -0700
Subject: cancel animations before updating value for min-shell animation
 (#4386)

* cancel animations before updating value

* comment
---
 src/state/shell/minimal-mode.tsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'src/state/shell/minimal-mode.tsx')

diff --git a/src/state/shell/minimal-mode.tsx b/src/state/shell/minimal-mode.tsx
index 05999db85..6e608daf4 100644
--- a/src/state/shell/minimal-mode.tsx
+++ b/src/state/shell/minimal-mode.tsx
@@ -1,5 +1,5 @@
 import React from 'react'
-import {SharedValue, useSharedValue, withSpring} from 'react-native-reanimated'
+import {cancelAnimation, SharedValue, useSharedValue, withSpring} from 'react-native-reanimated'
 
 type StateContext = SharedValue<number>
 type SetContext = (v: boolean) => void
@@ -17,6 +17,8 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
   const setMode = React.useCallback(
     (v: boolean) => {
       'worklet'
+      // Cancel any existing animation
+      cancelAnimation(mode)
       mode.value = withSpring(v ? 1 : 0, {
         overshootClamping: true,
       })
-- 
cgit 1.4.1

