Disable animation on scrollToTop for web (#2137)

This commit is contained in:
Paul Frazee 2023-12-07 13:41:02 -08:00 committed by GitHub
parent f115969f50
commit 940fc0ea5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 9 deletions

View file

@ -24,6 +24,7 @@ import {useTheme} from '#/lib/ThemeContext'
import {usePreferencesQuery} from '#/state/queries/preferences'
import {hydrateFeedGenerator} from '#/state/queries/feed'
import {FeedLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
import {isNative} from '#/platform/detection'
const LOADING = {_reactKey: '__loading__'}
const EMPTY = {_reactKey: '__empty__'}
@ -104,7 +105,10 @@ export const ProfileFeedgens = React.forwardRef<
const queryClient = useQueryClient()
const onScrollToTop = React.useCallback(() => {
scrollElRef.current?.scrollToOffset({offset: -headerOffset})
scrollElRef.current?.scrollToOffset({
animated: isNative,
offset: -headerOffset,
})
queryClient.invalidateQueries({queryKey: RQKEY(did)})
}, [scrollElRef, queryClient, headerOffset, did])