Skip to content

Commit

Permalink
Detach scroll listeners on hasMore prop change
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreGUI committed Mar 8, 2018
1 parent 179e3a6 commit 38625b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/InfiniteScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export default class InfiniteScroll extends Component {
this.attachScrollListener();
}

componentWillReceiveProps(nextProps) {
if (nextProps.hasMore === false) { this.detachMousewheelListener(); }
}

componentWillUnmount() {
this.detachScrollListener();
this.detachMousewheelListener();
Expand Down

0 comments on commit 38625b3

Please sign in to comment.