React-window: Use CSS Grid for FixedSizeGrid

Created on 4 Mar 2019  路  1Comment  路  Source: bvaughn/react-window

Hey,

I want to use the CSS Grid (display: grid) for the infinity scrolling mechanism.
But currently I don't see that I am able to change the styles of the inner div element. The FixedSizeGrid Component just have properties to apply some styles to the outer div. Is there a workaround for it or maybe a finished example how to do it?

馃挰 question

Most helpful comment

You would need to use the innerElementType prop to customize the styles of the inner div...

const innerElementType = ({ style, ...rest }) => (
  <div style={{ ...style, display: "grid" }} {...props} />
);

<FixedSizeList innerElementType={innerElementType} {...otherProps} />;

...although I would not expect display: grid to work or have any meaningful change since items are all explicitly absolutely positioned.

>All comments

You would need to use the innerElementType prop to customize the styles of the inner div...

const innerElementType = ({ style, ...rest }) => (
  <div style={{ ...style, display: "grid" }} {...props} />
);

<FixedSizeList innerElementType={innerElementType} {...otherProps} />;

...although I would not expect display: grid to work or have any meaningful change since items are all explicitly absolutely positioned.

Was this page helpful?
0 / 5 - 0 ratings