react-infinite-scroller
react-infinite-scroller copied to clipboard
getScrollParent doesn't work with ref, but works with id
Describe the bug
I was trying to use getScrollParent using the method suggested in the documentation. It didn't work. But I think that the problem might be in the typings, not in the code itself. I was not able to do getScrollParent={() => this.scrollParentRef} as TypeScript was not satisfied with passing React ref thing. I tried getScrollParent={() => this.scrollParentRef.current}, but it didn't work. In one of the issues' comment I've found a suggestion to use document.getElementById and it fixed the problem.
To Reproduce I don't want to spend more time on this, as it already took few hours to debug. I am mostly posting this issue for future archeologists who stumble upon this kinda dead project 🧟 👍
Expected behavior
I would expect this to work as documented :shrug: But the minimum fix for me would be to mention id usage in documentation 😇
Device (please complete the following information):
- OS:
MacOS 13.0.1 (22A400) - Browser
Firefox 107.0.1 (64-bit) - Version
"react-infinite-scroller": "^1.2.6"
For me it worked when I passed it like:
getScrollParent={() => parentRef.current ?? null}
Didn't gave any typescript errors either
const parentRef = useRef<HTMLElement>(null);