ankeetmaini / react-infinite-scroll-component

An awesome Infinite Scroll component in react.
https://react-infinite-scroll-component.netlify.com/
MIT License
2.87k stars 322 forks source link

next function doesn't called #402

Open Code-Guru-007 opened 4 months ago

Code-Guru-007 commented 4 months ago

I'm experiencing an issue where the next function of the InfiniteScroll component doesn't seem to work as expected. I've tried implementing a simple alert inside the next function, but nothing happens when I scroll to the end of the list. image

Thank you.

shravan-lambdatest commented 4 months ago

What is your scrollable region? If it's the <InfiniteScroll /> itself, pass fixed height and overflow. If it's some parent pass the scrollableTarget prop.

FYR: https://github.com/ankeetmaini/react-infinite-scroll-component/blob/d5b4e5250669022db5217763afd22fb3995a505a/src/index.tsx#L78

sapiens-shahbaz-khan commented 3 months ago

I'm experiencing an issue where the next function of the InfiniteScroll component doesn't seem to work as expected. I've tried implementing a simple alert inside the next function, but nothing happens when I scroll to the end of the list.

To have the feature working it requires a fixed height and overflow as mentioned above. I used :

     height: some calculated value,
     overflowY: 'scroll',
    position: 'sticky',

But also to keep in mind the children that you are passing to the Component. In your case the children is not an array of items but a wrapping component. In this case we must use hasChildren prop as false.

khuongtp commented 3 months ago

May I ask is it possible make it trigger next function even if the data is not overflow