diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-11-03 14:53:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-03 14:53:47 -0700 |
commit | 4de852ded83fd7f2445040792184ab83eab1e5e4 (patch) | |
tree | 537eaf9c180f6f5b6d02c4104fbcbe79c1da0df9 /src | |
parent | 445f976881429f54758569de69bc4bce3f88c60b (diff) | |
download | voidsky-4de852ded83fd7f2445040792184ab83eab1e5e4.tar.zst |
Refresh on scroll-to-top by active section press (#1807)
Diffstat (limited to 'src')
-rw-r--r-- | src/view/screens/ProfileFeed.tsx | 8 | ||||
-rw-r--r-- | src/view/screens/ProfileList.tsx | 9 |
2 files changed, 4 insertions, 13 deletions
diff --git a/src/view/screens/ProfileFeed.tsx b/src/view/screens/ProfileFeed.tsx index 70e52bf7a..3607ef82d 100644 --- a/src/view/screens/ProfileFeed.tsx +++ b/src/view/screens/ProfileFeed.tsx @@ -393,12 +393,8 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>( const onScrollToTop = useCallback(() => { scrollElRef.current?.scrollToOffset({offset: -headerHeight}) - }, [scrollElRef, headerHeight]) - - const onPressLoadLatest = React.useCallback(() => { - onScrollToTop() feed.refresh() - }, [feed, onScrollToTop]) + }, [feed, scrollElRef, headerHeight]) React.useImperativeHandle(ref, () => ({ scrollToTop: onScrollToTop, @@ -420,7 +416,7 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>( /> {(isScrolledDown || hasNew) && ( <LoadLatestBtn - onPress={onPressLoadLatest} + onPress={onScrollToTop} label="Load new posts" showIndicator={hasNew} /> diff --git a/src/view/screens/ProfileList.tsx b/src/view/screens/ProfileList.tsx index 4fc4b6c7f..28c69a90e 100644 --- a/src/view/screens/ProfileList.tsx +++ b/src/view/screens/ProfileList.tsx @@ -558,13 +558,8 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>( const onScrollToTop = useCallback(() => { scrollElRef.current?.scrollToOffset({offset: -headerHeight}) - }, [scrollElRef, headerHeight]) - - const onPressLoadLatest = React.useCallback(() => { - onScrollToTop() feed.refresh() - }, [feed, onScrollToTop]) - + }, [feed, scrollElRef, headerHeight]) React.useImperativeHandle(ref, () => ({ scrollToTop: onScrollToTop, })) @@ -586,7 +581,7 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>( /> {(isScrolledDown || hasNew) && ( <LoadLatestBtn - onPress={onPressLoadLatest} + onPress={onScrollToTop} label="Load new posts" showIndicator={hasNew} /> |