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

Commit

Permalink
Feat [UI/UX] [Front End] [Chat] smooth scrolling
Browse files Browse the repository at this point in the history
- [+] feat(chat.tsx): implement smooth scrolling behavior in chat component

Note: This adding back smooth scrolling
  • Loading branch information
H0llyW00dzZ committed Feb 10, 2024
1 parent 9dba614 commit f0eb177
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,10 @@ function useScrollToBottom() {
function scrollDomToBottom() {
const dom = scrollRef.current;
if (dom) {
requestAnimationFrame(() => {
requestAnimationFrame(() => { // this stupid frame might conflict with smooth behavior
setAutoScroll(isAutoScrollEnabled);
dom.scrollTo(0, dom.scrollHeight);
// Improve Use smooth scrolling behavior
dom.scrollTo({ top: dom.scrollHeight, behavior: 'smooth' });
});
}
}
Expand Down

0 comments on commit f0eb177

Please sign in to comment.