Merge pull request #283 from matrix-org/rav/issue_1427

Fix bug which stopped us scrolling down after we scrolled up
This commit is contained in:
Richard van der Hoff 2016-04-21 14:26:42 +01:00
commit 30f273c611
3 changed files with 89 additions and 5 deletions

View file

@ -241,11 +241,25 @@ var TimelinePanel = React.createClass({
if (this.unmounted) { return; }
debuglog("TimelinePanel: paginate complete backwards:"+backwards+"; success:"+r);
this.setState({
var newState = {
[paginatingKey]: false,
[canPaginateKey]: r,
events: this._getEvents(),
});
};
// moving the window in this direction may mean that we can now
// paginate in the other where we previously could not.
var otherDirection = backwards ? EventTimeline.FORWARDS : EventTimeline.BACKWARDS;
var canPaginateOtherWayKey = backwards ? 'canForwardPaginate' : 'canBackPaginate';
if (!this.state[canPaginateOtherWayKey] &&
this._timelineWindow.canPaginate(otherDirection)) {
debuglog('TimelinePanel: can now', otherDirection, 'paginate again');
newState[canPaginateOtherWayKey] = true;
}
this.setState(newState);
return r;
});
},