-
Notifications
You must be signed in to change notification settings - Fork 294
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
Added MasonryFlashList
which adds support for rendering masonry layouts
#587
Conversation
MasonryFlashList
which adds support for rendering masonry layouts
How are the odds this will be merged? |
@fortmarek this is good to go IMO. Thoughts? |
<img src="https://user-images.githubusercontent.com/7811728/188055598-41f5c961-0dd0-4bb9-bc6e-22d78596a036.png" height="500"/> | ||
</div> | ||
|
||
To get started, import `MasonryFlashList` from `@shopify/flash-list` and use it just like you would use `FlashList`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth here just putting a code snippet? I know it will be basically identical with flash-list
but imho still a good practice.
emptyScrollEvent.nativeEvent.doNotPropagate = true; | ||
onScrollProxy?.(emptyScrollEvent); | ||
emptyScrollEvent.nativeEvent.doNotPropagate = false; | ||
}, 32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
32 is two frames which is the minimum I need.
let's also add information about this. The amount of time for two frames also depends on the screen refresh rate but I'm ok with treating 60 Hz as the default.
I have only a couple of minor comments, mostly about the documentation. Additionally, as mentioned here, for now I'd mark this component as unstable or alpha before we are more confident in the stability of this feature. |
Co-authored-by: Marek Fořt <[email protected]>
Co-authored-by: Marek Fořt <[email protected]>
Co-authored-by: Marek Fořt <[email protected]>
Co-authored-by: Marek Fořt <[email protected]>
Co-authored-by: Marek Fořt <[email protected]>
Co-authored-by: Marek Fořt <[email protected]>
Co-authored-by: Marek Fořt <[email protected]>
@fortmarek Addressed the comments! Thanks for the review again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's goo 🚢 🚢
It should be fixed in v1.4.0 |
Does |
Can you flag an issue for this, please? 🙏 I'm personally not aware that Masonry layout doesn't support |
Yes, it's not possible to change spans in masonry. We'd appreciate a PR updating the docs! |
That's terribly upsetting to hear! We just did hours of work to implement Any chance to simply patch masonry to accept |
@naqvitalha if this is treated as a docs-only issue - at minimum these pages need updating:
There are a lot of places that will need updating to specify things that don't work in masonry mode it seems. Since this is likely to be a high demand feature in the long run, it seems better to focus on adding it in the near to medium-term future - but that's easy for me to say as I'm not a maintainer. |
any update on |
The docs were never updated as far as I know. It sure would be nice if this was supported. |
Description
resolves #455
resolves #575
resolves #589
This PR adds support for Masonry layout rendering also referred to as Staggered Grid View layout.
It's implemented using core FlashList and I didn't plan to make it part of this repo (initially) because it's technically like a derivative. I changed my mind because at the end of the day masonry is a layout and how it's implemented shouldn't matter. Ideally, anything that can be built using FlashList can be kept out. Keeping it lean is a win and should keep the core quality high.
I took the liberty to fix two additional bugs I found while building this otherwise there's no change in core. I've added comments to those changes.
Why use this approach?
It can be implemented using nested lists without any drawbacks and also doesn't require a new layout algorithm on the native side. It's incredibly fast as well.
Performance
It's incredibly well performing. Compared to 2x2 non masonry this is just 2% slower which may very well be a measurement problem.
Known issue
There's a prop type warning being thrown by RLV which I'll address when we upgrade RLV the next time.
Reviewers’ hat-rack 🎩
Screenshots or videos (if needed)
Checklist