From 2bcced72ad0bc91b429d25bde5639f7ab501b0a9 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 19 Mar 2019 16:51:39 +0100 Subject: [PATCH] take (potentially clipped) content height into account for filling --- src/components/structures/ScrollPanel.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index 5ddc0e0028..601caf78d6 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -298,11 +298,14 @@ module.exports = React.createClass({ // `---------' - // - if (sn.scrollTop < sn.clientHeight) { + const contentHeight = this._getMessagesHeight(); + const contentTop = contentHeight - this._getListHeight(); + const contentScrollTop = sn.scrollTop + contentTop; + if (contentScrollTop < sn.clientHeight) { // need to back-fill this._maybeFill(true); } - if (sn.scrollTop > sn.scrollHeight - sn.clientHeight * 2) { + if (contentScrollTop > contentHeight - sn.clientHeight * 2) { // need to forward-fill this._maybeFill(false); }