Merge pull request #2829 from matrix-org/travis/unread-button
Check if the message panel is at the end of the timeline on initpull/21833/head
commit
a0e3182e47
|
@ -145,6 +145,7 @@ module.exports = React.createClass({
|
||||||
// the end of the live timeline. It has the effect of hiding the
|
// the end of the live timeline. It has the effect of hiding the
|
||||||
// 'scroll to bottom' knob, among a couple of other things.
|
// 'scroll to bottom' knob, among a couple of other things.
|
||||||
atEndOfLiveTimeline: true,
|
atEndOfLiveTimeline: true,
|
||||||
|
atEndOfLiveTimelineInit: false, // used by componentDidUpdate to avoid unnecessary checks
|
||||||
|
|
||||||
showTopUnreadMessagesBar: false,
|
showTopUnreadMessagesBar: false,
|
||||||
|
|
||||||
|
@ -429,6 +430,18 @@ module.exports = React.createClass({
|
||||||
roomView.addEventListener('dragend', this.onDragLeaveOrEnd);
|
roomView.addEventListener('dragend', this.onDragLeaveOrEnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: We check the ref here with a flag because componentDidMount, despite
|
||||||
|
// documentation, does not define our messagePanel ref. It looks like our spinner
|
||||||
|
// in render() prevents the ref from being set on first mount, so we try and
|
||||||
|
// catch the messagePanel when it does mount. Because we only want the ref once,
|
||||||
|
// we use a boolean flag to avoid duplicate work.
|
||||||
|
if (this.refs.messagePanel && !this.state.atEndOfLiveTimelineInit) {
|
||||||
|
this.setState({
|
||||||
|
atEndOfLiveTimelineInit: true,
|
||||||
|
atEndOfLiveTimeline: this.refs.messagePanel.isAtEndOfLiveTimeline(),
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
|
|
Loading…
Reference in New Issue