Prevent autoscroll flag being cleared on mount by initial scroll tick
This commit is contained in:
parent
909c31dff8
commit
4dd9671e87
File diff suppressed because one or more lines are too long
@ -13,6 +13,7 @@ export default class MessageBox extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.mounted = true;
|
||||||
this.scrollTop = -1;
|
this.scrollTop = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,6 +114,7 @@ export default class MessageBox extends PureComponent {
|
|||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
handleScroll = ({ scrollTop, clientHeight, scrollHeight }) => {
|
handleScroll = ({ scrollTop, clientHeight, scrollHeight }) => {
|
||||||
|
if (this.mounted) {
|
||||||
if (this.props.hasMoreMessages &&
|
if (this.props.hasMoreMessages &&
|
||||||
scrollTop <= fetchThreshold &&
|
scrollTop <= fetchThreshold &&
|
||||||
scrollTop < this.prevScrollTop &&
|
scrollTop < this.prevScrollTop &&
|
||||||
@ -126,6 +128,7 @@ export default class MessageBox extends PureComponent {
|
|||||||
|
|
||||||
this.bottom = scrollTop + clientHeight >= scrollHeight - 10;
|
this.bottom = scrollTop + clientHeight >= scrollHeight - 10;
|
||||||
this.prevScrollTop = scrollTop;
|
this.prevScrollTop = scrollTop;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
handleMouseDown = () => {
|
handleMouseDown = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user