diff --git a/dist/InfiniteScroll.js b/dist/InfiniteScroll.js index 5bb22a3..badd7d1 100644 --- a/dist/InfiniteScroll.js +++ b/dist/InfiniteScroll.js @@ -113,8 +113,11 @@ var InfiniteScroll = (function(_Component) { { key: 'componentDidUpdate', value: function componentDidUpdate() { + var parentElement = this.getParentElement(this.scrollComponent); + if (this.props.pageStart === 0) { + parentElement.scrollTop = 0; + } if (this.props.isReverse && this.loadMore) { - var parentElement = this.getParentElement(this.scrollComponent); parentElement.scrollTop = parentElement.scrollHeight - this.beforeScrollHeight + @@ -161,6 +164,10 @@ var InfiniteScroll = (function(_Component) { useCapture: this.props.useCapture, passive: true }; + } else { + options = { + passive: false + }; } return options; } diff --git a/src/InfiniteScroll.js b/src/InfiniteScroll.js index 332f7bd..a0f76a6 100644 --- a/src/InfiniteScroll.js +++ b/src/InfiniteScroll.js @@ -47,8 +47,11 @@ export default class InfiniteScroll extends Component { } componentDidUpdate() { + const parentElement = this.getParentElement(this.scrollComponent); + if (this.props.pageStart === 0) { + parentElement.scrollTop = 0; + } if (this.props.isReverse && this.loadMore) { - const parentElement = this.getParentElement(this.scrollComponent); parentElement.scrollTop = parentElement.scrollHeight - this.beforeScrollHeight +