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

Suggestion: change padding-top & padding-bottom of the container #82

Open
felixmosh opened this issue Nov 28, 2019 · 6 comments
Open

Suggestion: change padding-top & padding-bottom of the container #82

felixmosh opened this issue Nov 28, 2019 · 6 comments

Comments

@felixmosh
Copy link

Hi,

I've investigated how virtuallization of Instagram works and saw that they are not using position: absolute at the children & not updating children positioning / styles at all, instead they changing padding-top & padding-bottom of the parent container! (SUPER COOOL 🤩).

WSdq465kVC

WDYT? can we refactor this lib to something similar?

@clauderic
Copy link
Owner

This is do-able, but I'm not clear on what the benefits would be. Have you tested the performance of this approach over the current approach?

@felixmosh
Copy link
Author

The benefit is that you are not using absolute positioning on the items, that means that the items will have native flow inside the container.

@clauderic
Copy link
Owner

You still need to provide exact height measurements for every single item, and you won't be able to use margin between the items, so I'm still not sure I see a clear benefit

@felixmosh
Copy link
Author

felixmosh commented Nov 28, 2019

There is margin between items in Insta & as you see there is no explicit height on the container but it derived, so there is a possibility to allow overflow... And it still work!

Additional benefite of native flow is the support for RTL in horizontal list for free.

@felixmosh
Copy link
Author

felixmosh commented Nov 29, 2019

Think of it, it not requires overflow: hidden & height on the wrapper, no need for position:absolute + height on each item...

@felixmosh
Copy link
Author

I see that twitter are doing the same thing
image

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

No branches or pull requests

2 participants