Add smart scrolling

This commit is contained in:
He4eT 2021-02-28 21:34:45 +05:00
commit 94059af89c

View file

@ -54,8 +54,15 @@ export default function ({ inbox, currentWindow }) {
: messages.concat(incoming))
setTimeout(() => {
const inputs =
textBufferEl.current.querySelectorAll('.message.input')
const lastInput =
inputs[inputs.length- 1]
textBufferEl.current.scrollTop =
textBufferEl.current.scrollHeight * 2
lastInput
? lastInput.offsetTop
: textBufferEl.current.scrollHeight * 2
}, 0)
}, [inbox])