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() {
|
||||
this.mounted = true;
|
||||
this.scrollTop = -1;
|
||||
}
|
||||
|
||||
@ -113,19 +114,21 @@ export default class MessageBox extends PureComponent {
|
||||
}, 100);
|
||||
|
||||
handleScroll = ({ scrollTop, clientHeight, scrollHeight }) => {
|
||||
if (this.props.hasMoreMessages &&
|
||||
scrollTop <= fetchThreshold &&
|
||||
scrollTop < this.prevScrollTop &&
|
||||
!this.loading) {
|
||||
if (this.mouseDown) {
|
||||
this.shouldFetch = true;
|
||||
} else {
|
||||
this.fetchMore();
|
||||
if (this.mounted) {
|
||||
if (this.props.hasMoreMessages &&
|
||||
scrollTop <= fetchThreshold &&
|
||||
scrollTop < this.prevScrollTop &&
|
||||
!this.loading) {
|
||||
if (this.mouseDown) {
|
||||
this.shouldFetch = true;
|
||||
} else {
|
||||
this.fetchMore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.bottom = scrollTop + clientHeight >= scrollHeight - 10;
|
||||
this.prevScrollTop = scrollTop;
|
||||
this.bottom = scrollTop + clientHeight >= scrollHeight - 10;
|
||||
this.prevScrollTop = scrollTop;
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseDown = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user