feat(mobile): entry list scroll to top for refetching

This commit is contained in:
DIYgod 2025-04-04 13:42:45 +08:00
parent 4ea69b916e
commit 9de4425b75
No known key found for this signature in database
1 changed files with 11 additions and 0 deletions

View File

@ -1,11 +1,13 @@
import { FeedViewType } from "@follow/constants"
import type { FlashList } from "@shopify/flash-list"
import { useEffect } from "react"
import { NoLoginInfo } from "@/src/components/common/NoLoginInfo"
import { useRegisterNavigationScrollView } from "@/src/components/layouts/tabbar/hooks"
import { EntryListContentPicture } from "@/src/modules/entry-list/EntryListContentPicture"
import { useWhoami } from "@/src/store/user/hooks"
import { useFetchEntriesControls } from "../feed-drawer/atoms"
import { EntryListContentArticle } from "./EntryListContentArticle"
import { EntryListContentSocial } from "./EntryListContentSocial"
import { EntryListContentVideo } from "./EntryListContentVideo"
@ -47,6 +49,15 @@ export function EntryListSelector({
}
}
const { isRefetching } = useFetchEntriesControls()
useEffect(() => {
if (isRefetching) {
ref?.current?.scrollToOffset({
offset: 0,
})
}
}, [isRefetching, ref])
return (
<EntryListContextViewContext.Provider value={viewId}>
{whoami ? (