bvaughn / react-window

React components for efficiently rendering large lists and tabular data
https://react-window.now.sh/
MIT License
15.54k stars 779 forks source link

different height for every options #675

Open leadstar116 opened 1 year ago

leadstar116 commented 1 year ago

I see that I need to pass itemSize prop which makes all items have the same height. How can I manage if all items are having different heights? Is there any way to handle it?

viktor-ulyankin commented 1 year ago

May be VariableSizeList ( https://react-window.vercel.app/#/examples/list/variable-size ) will help you?

leadstar116 commented 1 year ago

@viktor-ulyankin I am not sure I can get the height of the item without rendering...

Aliendreamer commented 1 year ago

this is why you render them and in useLayoutEffects you actually get the window.getclientrect.. and get the real sizes and that is, you set some basic width and height for start and then update it.