Fix Load More button didn't always work.
It did nothing if you weren't scrolled to the bottom of the page.
@@ -439,6 +439,11 @@ class RunFeed extends PureComponent {
);
const windowBottom = windowHeight + window.pageYOffset;
if (windowBottom >= docHeight) {
+ this.loadMore();
+ }
+ }
+
+ loadMore() {
if (this.props.data.loadMore) {
this.setState({pageLoading: true});
this.props.data.loadMore(() => {
@@ -446,7 +451,6 @@ class RunFeed extends PureComponent {
});
}
}
- }
componentDidMount() {
// window.addEventListener('scroll', () => this.handleScroll());
@@ -651,7 +655,7 @@ class RunFeed extends PureComponent {
</Table.Body>
</Table>
</div>
- <Button content="Load More" onClick={() => this.handleScroll()} />
+ <Button content="Load More" onClick={() => this.loadMore()} />
</div>
);
}
