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

@ -26,6 +26,7 @@ import {
import {RQKEY as NOTIFS_RQKEY} from '#/state/queries/notifications/feed'
import {listenSoftReset, emitSoftReset} from '#/state/events'
import {truncateAndInvalidate} from '#/state/queries/util'
import {isNative} from '#/platform/detection'
type Props = NativeStackScreenProps<
NotificationsTabNavigatorParams,
@ -47,7 +48,7 @@ export function NotificationsScreen({}: Props) {
// event handlers
// =
const scrollToTop = React.useCallback(() => {
scrollElRef.current?.scrollToOffset({offset: 0})
scrollElRef.current?.scrollToOffset({animated: isNative, offset: 0})
resetMainScroll()
}, [scrollElRef, resetMainScroll])