react-infinite-scroller: load more function is not getting invoked!
Load More function is not getting invoked when scroll to down
*Expected to see “loaded!”’ two three times but not, please help me

loadMoreBooks = async () => {
console.log('loaded!');
const data = await db.collection('books').get();
let books = this.state.books;
data.forEach(book => {
books = [...books, { id: book.id, ...book.data() }];
});
this.setState({ books });
};
// Render Method
<InfiniteScroll
pageStart={0}
loadMore={this.loadMoreBooks}
hasMore={hasMoreBooks}
loader={
<div className="loader" key={0}>
Loading ...
</div>
}
>
<Tiles maxCount={4}>{bookList}</Tiles>
</InfiniteScroll>
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 2
- Comments: 19
I found the point.
<InfiniteScroll><YourScrollDiv> other children ... </YourScrollDiv></InfiniteScroll>If any upper element has ‘overflow: auto;’ defined, it means that scroll area is not window anymore:
<InfiniteScroll ... getScrollParent={()=>document.getElementById('el-which-has-overflow-defined')} useWindow={false}>It’s the same here
@andrelmlins let me know if you solved somehow
Have the same issue on v1.2.4
For a temporary fix while they figure that out I went from
"react-infinite-scroller": "^1.2.2"to"react-infinite-scroller": "^1.2.1"and then it started working again.