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

* cancel animations before updating value

* comment
This commit is contained in:
Hailey 2024-06-06 06:28:02 -07:00 committed by GitHub
parent 85e676257e
commit 72f46ed734
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -1,6 +1,10 @@
import React, {useCallback, useEffect} from 'react'
import {NativeScrollEvent} from 'react-native'
import {interpolate, useSharedValue} from 'react-native-reanimated'
import {
cancelAnimation,
interpolate,
useSharedValue,
} from 'react-native-reanimated'
import EventEmitter from 'eventemitter3'
import {ScrollProvider} from '#/lib/ScrollContext'
@ -117,6 +121,8 @@ export function MainScrollProvider({children}: {children: React.ReactNode}) {
const newValue = clamp(startMode.value + dProgress, 0, 1)
if (newValue !== mode.value) {
// Manually adjust the value. This won't be (and shouldn't be) animated.
// Cancel any any existing animation
cancelAnimation(mode)
mode.value = newValue
}
} else {