create ResizeNotifier to derive which areas of the app resize and emit

This commit is contained in:
Bruno Windels 2019-03-12 16:36:12 +01:00
parent f71a9f10dd
commit 891e343df6
10 changed files with 75 additions and 6 deletions

View file

@ -392,7 +392,7 @@ module.exports = React.createClass({
this._updateConfCallNotification();
window.addEventListener('beforeunload', this.onPageUnload);
window.addEventListener('resize', this.onResize);
this.props.resizeNotifier.on("middlePanelResized", this.onResize);
this.onResize();
document.addEventListener("keydown", this.onKeyDown);
@ -472,7 +472,7 @@ module.exports = React.createClass({
}
window.removeEventListener('beforeunload', this.onPageUnload);
window.removeEventListener('resize', this.onResize);
this.props.resizeNotifier.removeListener("middlePanelResized", this.onResize);
document.removeEventListener("keydown", this.onKeyDown);
@ -1838,6 +1838,7 @@ module.exports = React.createClass({
className="mx_RoomView_messagePanel"
membersLoaded={this.state.membersLoaded}
permalinkCreator={this.state.permalinkCreator}
resizeNotifier={this.props.resizeNotifier}
/>);
let topUnreadMessagesBar = null;
@ -1870,7 +1871,7 @@ module.exports = React.createClass({
},
);
const rightPanel = this.state.room ? <RightPanel roomId={this.state.room.roomId} /> : undefined;
const rightPanel = this.state.room ? <RightPanel roomId={this.state.room.roomId} resizeNotifier={this.props.resizeNotifier} /> : undefined;
return (
<main className={"mx_RoomView" + (inCall ? " mx_RoomView_inCall" : "")} ref="roomView">
@ -1886,7 +1887,11 @@ module.exports = React.createClass({
onLeaveClick={(myMembership === "join") ? this.onLeaveClick : null}
e2eStatus={this.state.e2eStatus}
/>
<MainSplit panel={rightPanel} collapsedRhs={this.props.collapsedRhs}>
<MainSplit
panel={rightPanel}
collapsedRhs={this.props.collapsedRhs}
resizeNotifier={this.props.resizeNotifier}
>
<div className={fadableSectionClasses}>
{ auxPanel }
<div className="mx_RoomView_timeline">