From a8638390630ccfe679f550189612184c97ad3e2a Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 10 Dec 2015 22:04:52 +0000 Subject: [PATCH] Don't try to fiddle with the scroll state in search mode --- src/components/structures/RoomView.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 6ceaba3821..3695859ed1 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -275,8 +275,13 @@ module.exports = React.createClass({ }, componentDidUpdate: function() { + // 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). + if (!this.refs.messagePanel) return; + if (this.state.searchResults) return; var scrollState = this.savedScrollState; if (scrollState.atBottom) { this.scrollToBottom(); @@ -357,7 +362,7 @@ module.exports = React.createClass({ }, onMessageListScroll: function(ev) { - if (this.refs.messagePanel) { + if (this.refs.messagePanel && !this.state.searchResults) { this.savedScrollState = this._calculateScrollState(); if (this.savedScrollState.atBottom && this.state.numUnreadMessages != 0) { this.setState({numUnreadMessages: 0});