Fix the chat scroll behavior for vertical screens.

Fetch the messages until the scrollbar becomes visible, so that the user
always has the ability to scroll up and load new messages.
This commit is contained in:
eugenijm 2020-11-06 01:20:08 +03:00
parent dbeecd18ac
commit 15ea9d8c91
3 changed files with 17 additions and 1 deletions

View file

@ -24,3 +24,10 @@ export const isBottomedOut = (el, offset = 0) => {
export const scrollableContainerHeight = (inner, header, footer) => {
return inner.offsetHeight - header.clientHeight - footer.clientHeight
}
// Returns whether or not the scrollbar is visible.
export const isScrollable = (el) => {
if (!el) return
return el.scrollHeight > el.clientHeight
}