karl-run / react-bottom-scroll-listener

A simple listener component that invokes a callback when the webpage is scrolled to the bottom.
https://karl-run.github.io/react-bottom-scroll-listener
149 stars 15 forks source link

onBottom not call when container too small to be scrallable #31

Closed damienromito closed 4 years ago

damienromito commented 4 years ago

Everything is fine, but if my container no need to be scroll (because height smaller than parent container), the trigger isn't call

Thank you for your work

karl-run commented 4 years ago

Hmm, yes. If the page doesn't have any scroll the scroll event will never be triggerd, thus the callback will never be invoked.

Do you expect it to be called at least once?

damienromito commented 4 years ago

Yes. I display a button to go to the next page when the page can be fully read (= scrolled to the bottom). Then I need this feedback to display it. Then, it's depends on the size of the screen, it's a responsive issue

karl-run commented 4 years ago

I think this should to the trick for you, 8043161b23dd0d377178e87f3a90a85596f9f1f9.

Please try it out by adding the beta version of 4.1.0 (yarn add react-bottom-scroll-listener@beta) and trying out the new option in the hook.

damienromito commented 4 years ago

The option isn't available for the BottomScrollListener component ? Because the hooks does not works for me... (probably in my case) Regarding your code I'm ot sure it will keep the defaut behaviour with smaller screen Thank you for your time. If you have not more time, i'll try to push a something next week

karl-run commented 4 years ago

I've added the prop to the component as well and released a new beta version.

damienromito commented 4 years ago

It works ! Thank you ;)

karl-run commented 4 years ago

Cool. :) I've released it as stable.