Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cancel animations before updating value for min-shell animation (#4386)

* cancel animations before updating value

* comment

authored by

Hailey and committed by
GitHub
72f46ed7 85e67625

+10 -2
+3 -1
src/state/shell/minimal-mode.tsx
··· 1 1 import React from 'react' 2 - import {SharedValue, useSharedValue, withSpring} from 'react-native-reanimated' 2 + import {cancelAnimation, SharedValue, useSharedValue, withSpring} from 'react-native-reanimated' 3 3 4 4 type StateContext = SharedValue<number> 5 5 type SetContext = (v: boolean) => void ··· 17 17 const setMode = React.useCallback( 18 18 (v: boolean) => { 19 19 'worklet' 20 + // Cancel any existing animation 21 + cancelAnimation(mode) 20 22 mode.value = withSpring(v ? 1 : 0, { 21 23 overshootClamping: true, 22 24 })
+7 -1
src/view/com/util/MainScrollProvider.tsx
··· 1 1 import React, {useCallback, useEffect} from 'react' 2 2 import {NativeScrollEvent} from 'react-native' 3 - import {interpolate, useSharedValue} from 'react-native-reanimated' 3 + import { 4 + cancelAnimation, 5 + interpolate, 6 + useSharedValue, 7 + } from 'react-native-reanimated' 4 8 import EventEmitter from 'eventemitter3' 5 9 6 10 import {ScrollProvider} from '#/lib/ScrollContext' ··· 117 121 const newValue = clamp(startMode.value + dProgress, 0, 1) 118 122 if (newValue !== mode.value) { 119 123 // Manually adjust the value. This won't be (and shouldn't be) animated. 124 + // Cancel any any existing animation 125 + cancelAnimation(mode) 120 126 mode.value = newValue 121 127 } 122 128 } else {