feat(mobile): entry list scroll to top for refetching
This commit is contained in:
parent
4ea69b916e
commit
9de4425b75
|
|
@ -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 ? (
|
||||
|
|
|
|||
Loading…
Reference in New Issue