How to detect end of scroll on a container?

Hello. I need to detect end of scrolling on a container that contains options on my custom select component. The code that I have works well for me but on some Windows devices it just doesn’t and now I am having a hard time figuring out different solutions since I have tried changing the code multiple times yet the result is the same. Here is the code:

const handleScroll = (e: React.UIEvent<HTMLElement>) => {
    const { scrollHeight, scrollTop, clientHeight } = e.currentTarget
    const bottom = Math.abs(scrollHeight - clientHeight - scrollTop) < 10
    if (bottom) {
      setPage((prev) => prev + 1)
    }
  }

The bottom I guess is never true for other devices and I don’t know why. I also cannot reproduce this bug on my machine

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.