about summary refs log tree commit diff
path: root/src/view/screens/ProfileList.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-12-07 13:41:02 -0800
committerGitHub <noreply@github.com>2023-12-07 13:41:02 -0800
commit940fc0ea5c3aefb49f39d8de9398a306882ed567 (patch)
tree98b21e161808c011a84b858324778119aca37941 /src/view/screens/ProfileList.tsx
parentf115969f50b7f699696e71faabb4ae307177572e (diff)
downloadvoidsky-940fc0ea5c3aefb49f39d8de9398a306882ed567.tar.zst
Disable animation on scrollToTop for web (#2137)
Diffstat (limited to 'src/view/screens/ProfileList.tsx')
-rw-r--r--src/view/screens/ProfileList.tsx12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/view/screens/ProfileList.tsx b/src/view/screens/ProfileList.tsx
index f50c6afb3..923560efd 100644
--- a/src/view/screens/ProfileList.tsx
+++ b/src/view/screens/ProfileList.tsx
@@ -54,7 +54,7 @@ import {
 import {cleanError} from '#/lib/strings/errors'
 import {useSession} from '#/state/session'
 import {useComposerControls} from '#/state/shell/composer'
-import {isWeb} from '#/platform/detection'
+import {isNative, isWeb} from '#/platform/detection'
 import {truncateAndInvalidate} from '#/state/queries/util'
 import {
   usePreferencesQuery,
@@ -563,7 +563,10 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>(
     const [hasNew, setHasNew] = React.useState(false)
 
     const onScrollToTop = useCallback(() => {
-      scrollElRef.current?.scrollToOffset({offset: -headerHeight})
+      scrollElRef.current?.scrollToOffset({
+        animated: isNative,
+        offset: -headerHeight,
+      })
       queryClient.resetQueries({queryKey: FEED_RQKEY(feed)})
       setHasNew(false)
     }, [scrollElRef, headerHeight, queryClient, feed, setHasNew])
@@ -633,7 +636,10 @@ const AboutSection = React.forwardRef<SectionRef, AboutSectionProps>(
     )
 
     const onScrollToTop = useCallback(() => {
-      scrollElRef.current?.scrollToOffset({offset: -headerHeight})
+      scrollElRef.current?.scrollToOffset({
+        animated: isNative,
+        offset: -headerHeight,
+      })
     }, [scrollElRef, headerHeight])
 
     React.useImperativeHandle(ref, () => ({