diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-12-07 13:41:02 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-07 13:41:02 -0800 |
commit | 940fc0ea5c3aefb49f39d8de9398a306882ed567 (patch) | |
tree | 98b21e161808c011a84b858324778119aca37941 /src/view/screens/Profile.tsx | |
parent | f115969f50b7f699696e71faabb4ae307177572e (diff) | |
download | voidsky-940fc0ea5c3aefb49f39d8de9398a306882ed567.tar.zst |
Disable animation on scrollToTop for web (#2137)
Diffstat (limited to 'src/view/screens/Profile.tsx')
-rw-r--r-- | src/view/screens/Profile.tsx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index 946057efb..21353e5d3 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -38,6 +38,7 @@ import {listenSoftReset} from '#/state/events' import {truncateAndInvalidate} from '#/state/queries/util' import {Text} from '#/view/com/util/text/Text' import {usePalette} from 'lib/hooks/usePalette' +import {isNative} from '#/platform/detection' interface SectionRef { scrollToTop: () => void @@ -419,7 +420,10 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>( const [hasNew, setHasNew] = React.useState(false) const onScrollToTop = React.useCallback(() => { - scrollElRef.current?.scrollToOffset({offset: -headerHeight}) + scrollElRef.current?.scrollToOffset({ + animated: isNative, + offset: -headerHeight, + }) truncateAndInvalidate(queryClient, FEED_RQKEY(feed)) setHasNew(false) }, [scrollElRef, headerHeight, queryClient, feed, setHasNew]) |