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

Why is width required? #229

Closed
clauderic opened this issue May 11, 2016 · 4 comments
Closed

Why is width required? #229

clauderic opened this issue May 11, 2016 · 4 comments
Labels

Comments

@clauderic
Copy link
Collaborator

clauderic commented May 11, 2016

Why isn't the width prop optional? Shouldn't it just default to width: 100% and be an optional prop?

@bvaughn
Copy link
Owner

bvaughn commented May 11, 2016

A width property is required because there is no HTML element resize event and so there's no straight forward, native way for an element to detect its own size (if it changes). I feel it's better for react-virtualized components to be pure and stupid about their sizes. If you want 100% width or height behavior, use the AutoSize HOC.

@bvaughn bvaughn closed this as completed May 11, 2016
@clauderic
Copy link
Collaborator Author

I see your point, and part of me agrees with you, but I still feel like it's an opinionated standpoint that adds an unnecessary constraint.

I can definitely see the benefits of using AutoSize for the height of a component, but for the width... I feel like the AutoSize HOC adds an unnecessary layer of complexity, not to mention the performance hit (which is especially true when working with low powered mobile devices)

@bvaughn
Copy link
Owner

bvaughn commented May 11, 2016

You don't have to use AutoSizer if you don't plan on dynamic a (changing at runtime) width. Just read the width in your wrapper component and pass it down to whatever react-virtualized component you're using.

It is an opinionated standpoint but it provides the most flexibility to users. You can use a fixed-size, or AutoSizer, or your own lightweight wrapper. Should be pretty simple, no?

@mmontag
Copy link

mmontag commented Jul 29, 2024

This is disappointing. I am still confused on the answer. Why does List need to know the width of child elements at all if it's only going to be scrolled vertically?

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

3 participants