emit timeline_resize in MatrixChat based on ResizeNotifier

as it's used in PersistentElement which could be used at various places
This commit is contained in:
Bruno Windels 2019-03-12 16:37:20 +01:00
parent 891e343df6
commit 1bdbf3086f
3 changed files with 8 additions and 10 deletions

View file

@ -318,6 +318,9 @@ export default React.createClass({
// N.B. we don't call the whole of setTheme() here as we may be
// racing with the theme CSS download finishing from index.js
Tinter.tint();
// For PersistentElement
this.state.resizeNotifier.on("middlePanelResized", this._dispatchTimelineResize);
},
componentDidMount: function() {
@ -400,6 +403,7 @@ export default React.createClass({
dis.unregister(this.dispatcherRef);
window.removeEventListener("focus", this.onFocus);
window.removeEventListener('resize', this.handleResize);
this.state.resizeNotifier.removeListener("middlePanelResized", this._dispatchTimelineResize);
},
componentWillUpdate: function(props, state) {
@ -1667,6 +1671,10 @@ export default React.createClass({
this._windowWidth = window.innerWidth;
},
_dispatchTimelineResize() {
dis.dispatch({ action: 'timeline_resize' }, true);
},
onRoomCreated: function(roomId) {
dis.dispatch({
action: "view_room",