From acc47bad3ddd0334dc1f731fcd7a015174396e47 Mon Sep 17 00:00:00 2001 From: codytseng Date: Sat, 25 Jan 2025 22:45:33 +0800 Subject: [PATCH] feat: scroll to top on list tab switch --- src/components/NoteList/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/NoteList/index.tsx b/src/components/NoteList/index.tsx index 42ee7939..c4d0a734 100644 --- a/src/components/NoteList/index.tsx +++ b/src/components/NoteList/index.tsx @@ -60,6 +60,7 @@ export default function NoteList({ ...filter } }, [JSON.stringify(filter), isPictures]) + const topRef = useRef(null) useEffect(() => { if (relayUrls.length === 0) return @@ -174,14 +175,16 @@ export default function NoteList({ } return ( -
+
{ setListMode(listMode) + topRef.current?.scrollIntoView({ behavior: 'instant', block: 'end' }) storage.setNoteListMode(listMode) }} /> +
{ setRefreshCount((count) => count + 1)