parent
cb12a2cdd3
commit
b998ec7c72
|
@ -82,15 +82,19 @@ export default class ScrollableList extends PureComponent {
|
||||||
lastScrollWasSynthetic = false;
|
lastScrollWasSynthetic = false;
|
||||||
scrollToTopOnMouseIdle = false;
|
scrollToTopOnMouseIdle = false;
|
||||||
|
|
||||||
|
_getScrollingElement = () => {
|
||||||
|
if (this.props.bindToDocument) {
|
||||||
|
return (document.scrollingElement || document.body);
|
||||||
|
} else {
|
||||||
|
return this.node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setScrollTop = newScrollTop => {
|
setScrollTop = newScrollTop => {
|
||||||
if (this.getScrollTop() !== newScrollTop) {
|
if (this.getScrollTop() !== newScrollTop) {
|
||||||
this.lastScrollWasSynthetic = true;
|
this.lastScrollWasSynthetic = true;
|
||||||
|
|
||||||
if (this.props.bindToDocument) {
|
this._getScrollingElement().scrollTop = newScrollTop;
|
||||||
document.scrollingElement.scrollTop = newScrollTop;
|
|
||||||
} else {
|
|
||||||
this.node.scrollTop = newScrollTop;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -151,15 +155,15 @@ export default class ScrollableList extends PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
getScrollTop = () => {
|
getScrollTop = () => {
|
||||||
return this.props.bindToDocument ? document.scrollingElement.scrollTop : this.node.scrollTop;
|
return this._getScrollingElement().scrollTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
getScrollHeight = () => {
|
getScrollHeight = () => {
|
||||||
return this.props.bindToDocument ? document.scrollingElement.scrollHeight : this.node.scrollHeight;
|
return this._getScrollingElement().scrollHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
getClientHeight = () => {
|
getClientHeight = () => {
|
||||||
return this.props.bindToDocument ? document.scrollingElement.clientHeight : this.node.clientHeight;
|
return this._getScrollingElement().clientHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateScrollBottom = (snapshot) => {
|
updateScrollBottom = (snapshot) => {
|
||||||
|
|
Loading…
Reference in New Issue