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

FixedSizeList padding #74

Closed
khlieng opened this issue Oct 21, 2018 · 5 comments
Closed

FixedSizeList padding #74

khlieng opened this issue Oct 21, 2018 · 5 comments

Comments

@khlieng
Copy link

khlieng commented Oct 21, 2018

Is there a way to have padding at the top and bottom of a list? If I do 10px 0 on the outer div I get 20px of padding at the bottom, I can make it look proper by adding a 10px top margin to the list items but that just shifts the windowing off-center.

@bvaughn
Copy link
Owner

bvaughn commented Oct 21, 2018

No, padding like that isn't really supported within the list. If you want padding around the list, put the list inside of a padded container. 😊

This helps keeps the positioning logic inside of the list as simple as it can be.

@bvaughn bvaughn closed this as completed Oct 21, 2018
@khlieng
Copy link
Author

khlieng commented Oct 21, 2018

Ah ok, I wanted the padding inside the list like this https://jsfiddle.net/9wpd58mx/6/, I could just do it with a VariableSizeList.

@bvaughn
Copy link
Owner

bvaughn commented Oct 21, 2018

Oh, thanks for clarifying. I misunderstood! 😄

Yup, the easiest way to do that would be by adding in "padding" rows– one to the beginning and one to the end of your list.

@ahtcx
Copy link

ahtcx commented Sep 13, 2019

This can be fixed by adding position: relative; to the list, should I make a PR with a fix @bvaughn ?

@henryoliver
Copy link

Just subtract a given offset from the grid height:

const HEADER_OFFSET = 72;
...
return (
  <FixedSizeGrid
    ref={photoGridRef}
    width={width}
    height={height - HEADER_OFFSET}
    rowCount={rowCount}
    rowHeight={rowHeight}
    ...

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

4 participants