diff --git a/src/components/structures/RoomStatusBar.js b/src/components/structures/RoomStatusBar.js index 2e0897e3d0..9f338d5fcd 100644 --- a/src/components/structures/RoomStatusBar.js +++ b/src/components/structures/RoomStatusBar.js @@ -61,11 +61,13 @@ module.exports = React.createClass({ getInitialState: function() { return { syncState: MatrixClientPeg.get().getSyncState(), + whoisTypingString: WhoIsTyping.whoIsTypingString(this.props.room), }; }, componentWillMount: function() { MatrixClientPeg.get().on("sync", this.onSyncStateChange); + MatrixClientPeg.get().on("RoomMember.typing", this.onRoomMemberTyping); }, componentDidUpdate: function(prevProps, prevState) { @@ -76,8 +78,10 @@ module.exports = React.createClass({ componentWillUnmount: function() { // we may have entirely lost our client as we're logging out before clicking login on the guest bar... - if (MatrixClientPeg.get()) { - MatrixClientPeg.get().removeListener("sync", this.onSyncStateChange); + var client = MatrixClientPeg.get(); + if (client) { + client.removeListener("sync", this.onSyncStateChange); + client.removeListener("RoomMember.typing", this.onRoomMemberTyping); } }, @@ -90,6 +94,12 @@ module.exports = React.createClass({ }); }, + onRoomMemberTyping: function(ev, member) { + this.setState({ + whoisTypingString: WhoIsTyping.whoIsTypingString(this.props.room), + }); + }, + // determine if we need to call onResize _checkForResize: function(prevProps, prevState) { // figure out the old height and the new height of the status bar. We @@ -235,7 +245,7 @@ module.exports = React.createClass({ ); } - var typingString = WhoIsTyping.whoIsTypingString(this.props.room); + var typingString = this.state.whoisTypingString; if (typingString) { return (