Skip to content

react-window compatiblity #15

@Gibbo3771

Description

@Gibbo3771

I am trying to use this library with react-window to align a "sticky" header/row however because of the way react-window is working under the hood with the FixedSizeList, you have to wrap it in a div and this is the incorrect ref.

You can see a sandbox link here.

Here is a commented sec

<ScrollSyncNode group="a">
        <div> {/* ref in ScrollSync is made to this element*/}
          <List // But this creates a `div` that is the actual element we want to have a ref of
            className="List"
            height={75}
            itemCount={50}
            itemSize={100}
            layout="horizontal"
            width={300}
          >
            {Column}
          </List>
        </div>
      </ScrollSyncNode>

I tried removing the wrapping div, but I get a e.persist() is not a function, I assume this is because the ref is not passed down properly internally by react-window.

Is it possible to allow us to pass an as or component option prop for ScrollSyncNode that would take a forwardRef instance so we can pass the proper ref to ScrollSync?

I have tried using the outerElementType and innerElementType props for react-window components and rendering a ScrollSyncNode but same problem, since ScrollSyncNode clones it's children (ref won't be passed?) this creates weird side effects.

Any ideas? Also, nice library, much better than the unmaintained version and first class typescript support is always a welcome sight!

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