From c7c00b83166b10c4554773661ce8f66bdd6f1b14 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 5 May 2022 18:25:46 -0400 Subject: [PATCH] Ensure posts are not covered by the post draft on channel switch --- app/components/post_list/post_list.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/components/post_list/post_list.tsx b/app/components/post_list/post_list.tsx index 672af5cfd..d695ebeb4 100644 --- a/app/components/post_list/post_list.tsx +++ b/app/components/post_list/post_list.tsx @@ -116,8 +116,12 @@ const PostList = ({ }, [orderedPosts]); useEffect(() => { - listRef.current?.scrollToOffset({offset: 0, animated: false}); - }, [channelId]); + const t = setTimeout(() => { + listRef.current?.scrollToOffset({offset: 0, animated: false}); + }, 200); + + return () => clearTimeout(t); + }, [channelId, rootId]); useEffect(() => { const scrollToBottom = (screen: string) => {