mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 05:04:57 +08:00
update layout on window resize
This commit is contained in:
parent
cb9ebf8b8b
commit
2d2f9712b5
@ -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();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user