diff options
| author | eugenijm <eugenijm@protonmail.com> | 2020-11-06 01:20:08 +0300 |
|---|---|---|
| committer | eugenijm <eugenijm@protonmail.com> | 2020-11-06 11:11:19 +0300 |
| commit | 15ea9d8c917d6d0408a9c48f38976d19f9936054 (patch) | |
| tree | 61f09d9cf2e9fc80142f1b903198eed24d46ca90 /src/components/chat/chat_layout_utils.js | |
| parent | dbeecd18acfc14920c49324e08600dadba7127d7 (diff) | |
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.
Diffstat (limited to 'src/components/chat/chat_layout_utils.js')
| -rw-r--r-- | src/components/chat/chat_layout_utils.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/components/chat/chat_layout_utils.js b/src/components/chat/chat_layout_utils.js index 609dc0c9..50a933ac 100644 --- a/src/components/chat/chat_layout_utils.js +++ b/src/components/chat/chat_layout_utils.js @@ -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 +} |
