1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-06-26 04:01:04 +03:00

Update the scroll offset when images load

In order to deal with image-loading reshaping the DOM, wire up
ScrollPanel.checkScroll to the image load events.

Fixes https://github.com/vector-im/vector-web/issues/984
This commit is contained in:
Richard van der Hoff
2016-02-22 17:19:04 +00:00
parent 26e66326a2
commit 99d2392b6f
6 changed files with 57 additions and 12 deletions

View File

@ -124,10 +124,9 @@ module.exports = React.createClass({
// after adding event tiles, we may need to tweak the scroll (either to
// keep at the bottom of the timeline, or to maintain the view after
// adding events to the top).
this._restoreSavedScrollState();
// we also re-check the fill state, in case the paginate was inadequate
this.checkFillState();
//
// This will also re-check the fill state, in case the paginate was inadequate
this.checkScroll();
},
componentWillUnmount: function() {
@ -178,6 +177,13 @@ module.exports = React.createClass({
this.checkFillState();
},
// after an update to the contents of the panel, check that the scroll is
// where it ought to be, and set off pagination requests if necessary.
checkScroll: function() {
this._restoreSavedScrollState();
this.checkFillState();
},
// return true if the content is fully scrolled down right now; else false.
//
// note that this is independent of the 'stuckAtBottom' state - it is simply