question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

load more function is not getting invoked!

See original GitHub issue

Load More function is not getting invoked when scroll to down *Expected to see “loaded!”’ two three times but not, please help me screenshot from 2018-10-16 15-11-00

       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>

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:19

github_iconTop GitHub Comments

22reactions
totemteccommented, Jul 4, 2019

I found the point.

  1. if your scroll area not window, userWindow={false}
  2. make sure the InfiniteScroll tag directly wrap the scroll area like that <InfiniteScroll><YourScrollDiv> other children ... </YourScrollDiv></InfiniteScroll>
6reactions
hennadiy-kudashevcommented, Feb 9, 2021

If any upper element has ‘overflow: auto;’ defined, it means that scroll area is not window anymore:

  1. userWindow={false}
  2. define getScrollParent function to return ‘scroll area’ dom element

<InfiniteScroll ... getScrollParent={()=>document.getElementById('el-which-has-overflow-defined')} useWindow={false}>

Read more comments on GitHub >

github_iconTop Results From Across the Web

“react-infinite-scroll-component” Stopped working after one ...
I had this issue. It turns out I was using dataLength in the wrong way. I thought it was supposed to be the...
Read more >
Load more functionality in ReactJS - Level Up Coding
In this article, we are going to look at a form of pagination that involves using a load more button, that when clicked...
Read more >
JavaScript Function Invocation - W3Schools
This is a common way to invoke a JavaScript function, but not a very good practice. Global variables, methods, or functions can easily...
Read more >
Passing Functions to Components - React
Pass event handlers and other functions as props to child components: ... Throttling prevents a function from being called more than once in...
Read more >
Best practices for working with AWS Lambda functions
This allows you to make a more unit-testable function. ... make sure the value of the function's expected invocation time does not exceed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found