From 2d2f9712b5682086c109170fab1331229bb3a06a Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 25 Jan 2019 18:48:25 +0100 Subject: [PATCH] update layout on window resize --- src/components/views/rooms/RoomList.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index 0c910f6808..3cbd8b0a4b 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -196,6 +196,7 @@ module.exports = React.createClass({ this._checkSubListsOverflow(); this.resizer.attach(); + window.addEventListener("resize", this.onWindowResize); this.mounted = true; }, @@ -241,6 +242,7 @@ module.exports = React.createClass({ componentWillUnmount: function() { this.mounted = false; + window.removeEventListener("resize", this.onWindowResize); dis.unregister(this.dispatcherRef); if (MatrixClientPeg.get()) { MatrixClientPeg.get().removeListener("Room", this.onRoom); @@ -270,6 +272,17 @@ module.exports = React.createClass({ this._delayedRefreshRoomList.cancelPendingCall(); }, + onWindowResize: function() { + if (this.mounted && this._layout && this.resizeContainer && + Array.isArray(this._layoutSections) + ) { + this._layout.update( + this._layoutSections, + this.resizeContainer.offsetHeight + ); + } + }, + onRoom: function(room) { this.updateVisibleRooms(); },