From 454faac829d6e17635ddc2e3ee4311733197f0a8 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Mon, 4 Dec 2023 00:01:08 -0300 Subject: [PATCH] Fix auto-scroll in SurahStream.tsx (mobile / iOS) --- src/js/components/Stream.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/components/Stream.tsx b/src/js/components/Stream.tsx index 44de9b6..ccc8d54 100644 --- a/src/js/components/Stream.tsx +++ b/src/js/components/Stream.tsx @@ -51,8 +51,9 @@ export function Stream({ useEffect(() => { const ul: HTMLElement = document.querySelector("ul.stream")!; - ul.scroll({ top: ul.scrollHeight, behavior: "smooth" }); - }, [stream]); + const top = ul.scrollHeight; + ul.scrollBy({ behavior: "smooth", top }); + }, [stream.length]); return (