Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discussion: deprecate / replace / improve ResizeSensor? #1413

Open
giogonzo opened this issue Jan 2, 2020 · 0 comments
Open

discussion: deprecate / replace / improve ResizeSensor? #1413

giogonzo opened this issue Jan 2, 2020 · 0 comments
Labels

Comments

@giogonzo
Copy link
Member

giogonzo commented Jan 2, 2020

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:

  • if ResizeSensor is used somewhere for the first simple use case, keep it as is. Otherwise remove the component
  • add FlexAutoSizer or similar component, providing dimensions out of the box. Implement it either based on an external dependency (if ResizeSensor is removed) or on top of ResizeSensor itself.

Opinions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant