bvaughn / react-virtualized

React components for efficiently rendering large lists and tabular data
http://bvaughn.github.io/react-virtualized/
MIT License
26.31k stars 3.05k forks source link

Add custom container component #1700

Closed zarifabdalimov closed 2 years ago

zarifabdalimov commented 2 years ago

Hello, I would like to use react-spring with react-virtualized. To achieve animation with react-spring I should use animated.div instead of normal div. Then I can pass animation props to animated.div via containerProps. Minified example:

     const { scroll: scrollLeft } = useSpring({
        scroll: (scrollToColumn) * cellWidth,
        reset: false,
        delay: 200,
        config: config.molasses,
    })

    return (
        <VirtualGridStyled
            cellRenderer={renderCell}
            columnCount={itemsCount}
            containerComponent={animated.div}
            containerProps={{
                scrollLeft,
            }}
            scrollToAlignment="start"
            columnWidth={cellWidth}
            overscanIndicesGetter={carouselOverscanIndicesGetter}
            height={cellHeight}
            rowCount={1}
            rowHeight={cellHeight}
            width={width}
        />
    )

I added prop - containerComponent, so I can pass custom container component

Thank you

zarifabdalimov commented 2 years ago

@bvaughn please make a review 😄

zarifabdalimov commented 2 years ago

@yamadapc @wuweiweiwu maybe you can make a review please 😅