From 4a24cdfedf64f0135198761bea9cced038c63a79 Mon Sep 17 00:00:00 2001 From: Outrun Colors Date: Sat, 24 Sep 2022 22:28:09 -0500 Subject: [PATCH] Scroll to bottom of chat when any drawer closes --- chat/package.json | 2 +- chat/src/App.tsx | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/chat/package.json b/chat/package.json index 4df129f8c..8a5b4e211 100644 --- a/chat/package.json +++ b/chat/package.json @@ -1,6 +1,6 @@ { "name": "chat", - "version": "0.0.21", + "version": "0.0.22", "main": "./src/index.tsx", "license": "MIT", "dependencies": { diff --git a/chat/src/App.tsx b/chat/src/App.tsx index 6eb01dfad..d4d774754 100644 --- a/chat/src/App.tsx +++ b/chat/src/App.tsx @@ -58,6 +58,13 @@ function AppInner() { contentWrapper.current.scrollTop = contentWrapper.current.scrollHeight; } }, [messages]); + + useEffect(() => { + if (!open) { + // Scroll to the bottom after any drawer closes. + contentWrapper.current.scrollTop = contentWrapper.current.scrollHeight; + } + }, [open]); return (