mirror of https://github.com/vector-im/riot-web
track whether we're scrolled to bottom or not and display UI for warning & jumping there if needed.
parent
28fddef5f9
commit
f15564074c
|
@ -84,7 +84,8 @@ module.exports = React.createClass({
|
||||||
guestsCanJoin: false,
|
guestsCanJoin: false,
|
||||||
canPeek: false,
|
canPeek: false,
|
||||||
readMarkerEventId: room ? room.getEventReadUpTo(MatrixClientPeg.get().credentials.userId) : null,
|
readMarkerEventId: room ? room.getEventReadUpTo(MatrixClientPeg.get().credentials.userId) : null,
|
||||||
readMarkerGhostEventId: undefined
|
readMarkerGhostEventId: undefined,
|
||||||
|
atBottom: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -596,9 +597,18 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onMessageListScroll: function(ev) {
|
onMessageListScroll: function(ev) {
|
||||||
if (this.state.numUnreadMessages != 0 &&
|
if (this.refs.messagePanel.isAtBottom()) {
|
||||||
this.refs.messagePanel.isAtBottom()) {
|
if (this.state.numUnreadMessages != 0) {
|
||||||
this.setState({numUnreadMessages: 0});
|
this.setState({ numUnreadMessages: 0 });
|
||||||
|
}
|
||||||
|
if (!this.state.atBottom) {
|
||||||
|
this.setState({ atBottom: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (this.state.atBottom) {
|
||||||
|
this.setState({ atBottom: false });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1622,7 +1632,7 @@ module.exports = React.createClass({
|
||||||
else if (unreadMsgs) {
|
else if (unreadMsgs) {
|
||||||
statusBar = (
|
statusBar = (
|
||||||
<div className="mx_RoomView_unreadMessagesBar" onClick={ this.scrollToBottom }>
|
<div className="mx_RoomView_unreadMessagesBar" onClick={ this.scrollToBottom }>
|
||||||
<img src="img/newmessages.png" width="24" height="24" alt=""/>
|
<img src="img/newmessages.svg" width="24" height="24" alt=""/>
|
||||||
{unreadMsgs}
|
{unreadMsgs}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1635,6 +1645,13 @@ module.exports = React.createClass({
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else if (!this.state.atBottom) {
|
||||||
|
statusBar = (
|
||||||
|
<div className="mx_RoomView_scrollToBottomBar" onClick={ this.scrollToBottom }>
|
||||||
|
<img src="img/scrolldown.svg" width="24" height="24" alt="Scroll to bottom of page"/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var aux = null;
|
var aux = null;
|
||||||
|
|
Loading…
Reference in New Issue