diff options
author | Hailey <me@haileyok.com> | 2024-06-06 06:28:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-06 14:28:02 +0100 |
commit | 72f46ed7349f5044d7b89fc8c7f5414b0805a67b (patch) | |
tree | 8ec2cbd1d1c3ef001db4f6d6c0363a32d6066dc9 /src/state/shell | |
parent | 85e676257ec590b7fb05d9cc1e7ac352d7d89c09 (diff) | |
download | voidsky-72f46ed7349f5044d7b89fc8c7f5414b0805a67b.tar.zst |
cancel animations before updating value for min-shell animation (#4386)
* cancel animations before updating value * comment
Diffstat (limited to 'src/state/shell')
-rw-r--r-- | src/state/shell/minimal-mode.tsx | 4 |
1 files changed, 3 insertions, 1 deletions
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, }) |