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

Content padding support #626

Merged
merged 13 commits into from
Nov 2, 2022
Merged

Content padding support #626

merged 13 commits into from
Nov 2, 2022

Conversation

naqvitalha
Copy link
Collaborator

@naqvitalha naqvitalha commented Oct 5, 2022

Description

resolves #621

We've had to ignore horizontal padding on vertical lists and the opposite for horizontal ones due to layout complexities. This PR solves the problem and avoids any performance regression.

Motivation

Doing this now was important because, in regular FlashList, padding can simply be added to items but in masonry, we change the order of items and it's quite complex to add something as simple as content padding. Developers need to render and update items based on their columns.

Reviewers’ hat-rack 🎩

  • Try playing with contentContainerStyle in any of the sample.
  • Check performance regression (there isn't any but doesn't hurt to check)

Checklist

@naqvitalha naqvitalha marked this pull request as ready for review October 6, 2022 16:26
@naqvitalha naqvitalha requested a review from fortmarek October 6, 2022 16:28
@sebastienlabine
Copy link

Thank you. When should we expect this? Can't fully migrate our code to flashlist because most of our components uses horizontal padding making.

@naqvitalha
Copy link
Collaborator Author

@sebastienlabine It'll take sometime. However, for everything other than masonry you can easily apply padding to your items. There's no need to wait for this.
It's not as convenient but still worth it given the boost you get.

@naqvitalha
Copy link
Collaborator Author

@fortmarek Can you take a look at this when you have time? It'll be very helpful for the community

Copy link
Contributor

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎩 'd and everything works as expected. Just a couple of nits but nothing that would block merging this 👏

src/utils/ContentContainerUtils.ts Show resolved Hide resolved
src/GridLayoutProviderWithProps.ts Show resolved Hide resolved
src/utils/ContentContainerUtils.ts Show resolved Hide resolved
src/utils/ContentContainerUtils.ts Show resolved Hide resolved
src/MasonryFlashList.tsx Show resolved Hide resolved
@naqvitalha naqvitalha merged commit 218f314 into main Nov 2, 2022
@naqvitalha naqvitalha deleted the contentPaddingSupport branch November 2, 2022 22:02
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

Successfully merging this pull request may close these issues.

Support all padding props in contentContainerStyle
3 participants