Skip to content

Commit 7979875

Browse files
committed
Detach scroll listeners on hasMore prop change
Fix danbovey#44
1 parent 179e3a6 commit 7979875

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/InfiniteScroll.js

+7
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ export default class InfiniteScroll extends Component {
4646
this.attachScrollListener();
4747
}
4848

49+
componentWillReceiveProps(nextProps) {
50+
if (nextProps.hasMore === false) {
51+
this.detachScrollListener();
52+
this.detachMousewheelListener();
53+
}
54+
}
55+
4956
componentWillUnmount() {
5057
this.detachScrollListener();
5158
this.detachMousewheelListener();

0 commit comments

Comments
 (0)