Skip to content

Cannot read property clientHeight of null when using height inside of a shadowRoot #314

Open
@j3ski

Description

@j3ski

Hello.

I'm trying to use this library inside of a component contained in a shadow root. Once I add the height prop I start getting this error when scrolling.

Here is the minimal reproducible example: https://codesandbox.io/s/small-sun-c5n0i?file=/src/App.js.

And here's the code

import root from "react-shadow";
import InfiniteScroll from "react-infinite-scroll-component";

export default function App() {
  return (
    <root.div>
      <InfiniteScroll dataLength={100} hasMore height="70vh">
        <div style={{ height: "200vh" }}>Scroll me!</div>
      </InfiniteScroll>
    </root.div>
  );
}

It seems that the scroll event can be triggered with a null target in this case, but I don't know exactly why.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions