You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-28 15:22:05 +03:00
restore scroll state when timeline resizes using ResizeObserver
(only where supported, polyfill doesn't give good results)
This commit is contained in:
@ -160,6 +160,13 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
this.checkScroll();
|
this.checkScroll();
|
||||||
|
|
||||||
|
if (typeof ResizeObserver !== "undefined") {
|
||||||
|
this._timelineSizeObserver = new ResizeObserver(() => {
|
||||||
|
this._restoreSavedScrollState();
|
||||||
|
});
|
||||||
|
this._timelineSizeObserver.observe(this.refs.itemlist);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidUpdate: function() {
|
componentDidUpdate: function() {
|
||||||
@ -181,6 +188,10 @@ module.exports = React.createClass({
|
|||||||
//
|
//
|
||||||
// (We could use isMounted(), but facebook have deprecated that.)
|
// (We could use isMounted(), but facebook have deprecated that.)
|
||||||
this.unmounted = true;
|
this.unmounted = true;
|
||||||
|
if (this._timelineSizeObserver) {
|
||||||
|
this._timelineSizeObserver.disconnect();
|
||||||
|
this._timelineSizeObserver = null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onScroll: function(ev) {
|
onScroll: function(ev) {
|
||||||
|
Reference in New Issue
Block a user