Skip to content

Why items are absolutely positioned?  #133

@bhovhannes

Description

@bhovhannes

Hi,
Thank you for rewriting react-virtualized, react-window is far cleaner!

I have one question. In both react-virtualized and react-window cells are absolutely positioned. Why?

I have made react-virtualized work with statically positioned items, by inserting a "spacer" div before rows via cellRangeRenderer. That spacer div has margin-top set to the style.top of first rendered row.
When rows are positioned statically

  1. There is no need to update top on each row element during scrolling, which makes React update faster.
  2. Overlap issues are completely impossible, because rows naturally flow one after another. By saying overlap issues I mean issues when some row dynamically changes its height but Grid consumer don't call recomputeBodyGridSize to make Grid recalculate top offsets for each row so as a result upper row renders overlapping next row.
  3. There is no need in storing top offsets for each row and maintaining style cache.

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