buildo / react-components

Collection of general React components used in buildo projects.
http://react-components.buildo.io/
MIT License
157 stars 21 forks source link

discussion: deprecate / replace / improve ResizeSensor? #1413

Open giogonzo opened 4 years ago

giogonzo commented 4 years ago

Current API asks the user to measure and track the size of the target container, i.e. it will only invoke a callback on "resize". This is fine if you only want to re-render on change (relatively rare in my opinion), but harder if you also need to obtain exact width/height of an element.

There are many other helpers providing this feature including dimensions in pixels out there, e.g. react-virtualized-auto-size

The main use case I see this component used in our apps is: render a vertical virtualized list inside of a flex-growing View somewhere in a page. For this specific use case, react-virtualized-auto-size (and I guess similarly the other available solutions) don't work 100% fine out of the box i.e.: you'll still have to provide a growing box (<FlexView grow width="100%" />) for it as a parent. For this reason, it might make sense to include such an helper in BRC?

Before making any decisions here, we should analyze slightly better all the ResizeSensor usages in our projects.

Sketched proposal:

Opinions?