Skip to content
This repository was archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
Simplify [UI/UX] [Chats] [Front End] scrollToBottom (#244)
Browse files Browse the repository at this point in the history
- [+] refactor(chat.tsx): simplify scrollToBottom function with smooth scrolling behavior
  • Loading branch information
H0llyW00dzZ authored Feb 5, 2024
1 parent 8dcb8df commit 83ecda7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,8 @@ function useScrollToBottom() {
function scrollDomToBottom() {
const dom = scrollRef.current;
if (dom) {
requestAnimationFrame(() => {
setAutoScroll(true);
dom.scrollTo(0, dom.scrollHeight);
});
// Improve Use smooth scrolling behavior
dom.scrollTo({ top: dom.scrollHeight, behavior: 'smooth' });
}
}

Expand Down

0 comments on commit 83ecda7

Please sign in to comment.