You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-24 06:02:08 +03:00
fix jumping when unfilling the top while scrolling down
This commit is contained in:
@ -642,11 +642,17 @@ module.exports = React.createClass({
|
|||||||
// the currently filled piece of the timeline
|
// the currently filled piece of the timeline
|
||||||
if (trackedNode) {
|
if (trackedNode) {
|
||||||
const oldTop = trackedNode.offsetTop;
|
const oldTop = trackedNode.offsetTop;
|
||||||
|
// changing the height might change the scrollTop
|
||||||
|
// if the new height is smaller than the scrollTop.
|
||||||
|
// We calculate the diff that needs to be applied
|
||||||
|
// ourselves, so be sure to measure the
|
||||||
|
// scrollTop before changing the height.
|
||||||
|
const preexistingScrollTop = sn.scrollTop;
|
||||||
itemlist.style.height = `${newHeight}px`;
|
itemlist.style.height = `${newHeight}px`;
|
||||||
const newTop = trackedNode.offsetTop;
|
const newTop = trackedNode.offsetTop;
|
||||||
const topDiff = newTop - oldTop;
|
const topDiff = newTop - oldTop;
|
||||||
sn.scrollTop = sn.scrollTop + topDiff;
|
sn.scrollTop = preexistingScrollTop + topDiff;
|
||||||
debuglog("updateHeight to", newHeight, topDiff);
|
debuglog("updateHeight to", {newHeight, topDiff, preexistingScrollTop});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user