From 2c2d12b3949dfbb26e8fadecfe9dfecfe3f6962d Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 26 Nov 2024 23:56:57 +0000 Subject: Fix stutter when swiping feeds on Android (#6765) --- src/state/shell/minimal-mode.tsx | 10 +--------- src/view/com/util/MainScrollProvider.tsx | 4 ---- 2 files changed, 1 insertion(+), 13 deletions(-) (limited to 'src') diff --git a/src/state/shell/minimal-mode.tsx b/src/state/shell/minimal-mode.tsx index 00547ee3e..eba3aa2b0 100644 --- a/src/state/shell/minimal-mode.tsx +++ b/src/state/shell/minimal-mode.tsx @@ -1,10 +1,5 @@ import React from 'react' -import { - cancelAnimation, - SharedValue, - useSharedValue, - withSpring, -} from 'react-native-reanimated' +import {SharedValue, useSharedValue, withSpring} from 'react-native-reanimated' type StateContext = { headerMode: SharedValue @@ -42,14 +37,11 @@ export function Provider({children}: React.PropsWithChildren<{}>) { const setMode = React.useCallback( (v: boolean) => { 'worklet' - // Cancel any existing animation - cancelAnimation(headerMode) headerMode.set(() => withSpring(v ? 1 : 0, { overshootClamping: true, }), ) - cancelAnimation(footerMode) footerMode.set(() => withSpring(v ? 1 : 0, { overshootClamping: true, diff --git a/src/view/com/util/MainScrollProvider.tsx b/src/view/com/util/MainScrollProvider.tsx index 0d084993b..42b2e12df 100644 --- a/src/view/com/util/MainScrollProvider.tsx +++ b/src/view/com/util/MainScrollProvider.tsx @@ -1,7 +1,6 @@ import React, {useCallback, useEffect} from 'react' import {NativeScrollEvent} from 'react-native' import { - cancelAnimation, interpolate, makeMutable, useSharedValue, @@ -43,7 +42,6 @@ export function MainScrollProvider({children}: {children: React.ReactNode}) { const setMode = React.useCallback( (v: boolean) => { 'worklet' - cancelAnimation(headerMode) headerMode.set(v ? V1.get() : V0.get()) }, [headerMode], @@ -149,8 +147,6 @@ export function MainScrollProvider({children}: {children: React.ReactNode}) { const newValue = clamp(startModeValue + dProgress, 0, 1) if (newValue !== headerMode.get()) { // Manually adjust the value. This won't be (and shouldn't be) animated. - // Cancel any any existing animation - cancelAnimation(headerMode) headerMode.set(newValue) } } else { -- cgit 1.4.1