Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion dist/InfiniteScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down Expand Up @@ -161,6 +164,10 @@ var InfiniteScroll = (function(_Component) {
useCapture: this.props.useCapture,
passive: true
};
} else {
options = {
passive: false
};
}
return options;
}
Expand Down
5 changes: 4 additions & 1 deletion src/InfiniteScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down