React-virtualized: v9.12 List not working in Chrome v62: scroll bar sticks, rows flicker, fail to render

Created on 3 Nov 2017  路  4Comments  路  Source: bvaughn/react-virtualized

Example: https://plnkr.co/edit/pXffbuQpJ8ZPumRCVg2G?p=preview

Usage like:

const htmlEl = document.body.appendChild(document.createElement('div'))
ReactDOM.render(React.createElement('div', {
    style: {
        background: 'pink',
        height: 600,
        width: 600,
    },
}, React.createElement(ReactVirtualized.List, {
    height: 600,
    width: 600,
    rowCount: 1000,
    rowHeight: 20,
    rowRenderer: function (options) {
        return React.createElement('div', {
            key: options.index,
            style: { height: 20 },
        }, 'asdf')
    }
})), htmlEl)

virtualized-list

Most helpful comment

I had missed the style prop on the row renderer.

All 4 comments

I had missed the style prop on the row renderer.

@christophercliff Can you explain how you fixed it? I have the same issue and can't get it to work, even with your example
EDIT: actually finally understood what it means

Explained here: https://github.com/bvaughn/react-virtualized/blob/master/docs/List.md#rowrenderer

rowRenderer = ({ style }) => (<div style={style} />)

I've stuck in this for a few hours too, so you just have to wrap an additional <div style={style}> outside your true element then it's all fine. The style passed into rowRenderer() is like this:

height: 63px
left: 0px
position: absolute
top: 0px => varying for all list elements, like 63px, 126px...etc.
width: 100%

so wrap the element with this style then react-virtualized's List could correctly control the positions.

Was this page helpful?
0 / 5 - 0 ratings