You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-22 04:02:40 +03:00
update layout on window resize
This commit is contained in:
@@ -196,6 +196,7 @@ module.exports = React.createClass({
|
|||||||
this._checkSubListsOverflow();
|
this._checkSubListsOverflow();
|
||||||
|
|
||||||
this.resizer.attach();
|
this.resizer.attach();
|
||||||
|
window.addEventListener("resize", this.onWindowResize);
|
||||||
this.mounted = true;
|
this.mounted = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -241,6 +242,7 @@ module.exports = React.createClass({
|
|||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
this.mounted = false;
|
this.mounted = false;
|
||||||
|
|
||||||
|
window.removeEventListener("resize", this.onWindowResize);
|
||||||
dis.unregister(this.dispatcherRef);
|
dis.unregister(this.dispatcherRef);
|
||||||
if (MatrixClientPeg.get()) {
|
if (MatrixClientPeg.get()) {
|
||||||
MatrixClientPeg.get().removeListener("Room", this.onRoom);
|
MatrixClientPeg.get().removeListener("Room", this.onRoom);
|
||||||
@@ -270,6 +272,17 @@ module.exports = React.createClass({
|
|||||||
this._delayedRefreshRoomList.cancelPendingCall();
|
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) {
|
onRoom: function(room) {
|
||||||
this.updateVisibleRooms();
|
this.updateVisibleRooms();
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user