Closed animmore closed 2 years ago
You can use overrideItemLayout
prop to increase span of your header to 2.
You can use
overrideItemLayout
prop to increase span of your header to 2.
Thanks. That workes👍
I'm having no luck with overrideItemLayout
Our code looks like this, but everything remains a maximum of one column wide:
overrideItemLayout={(layout, item, index, maxColumns) => {
layout.span = 2;
maxColumns = 2;
}}
@Slapbox numColumns={2} needs to be set on FlashList.
@naqvitalha thanks for your reply! Unfortunately we're already using numColumns={2}
- is there anything else we can try? We're on version 1.3.1
, but I don't see anything in the changelog to suggest any fixes/changes related to this in newer versions, and I think we're currently locked into 1.3.x
due to using Expo.
Any other things we might check? Thanks again!
This function has been there since v1. Are you using this with masonry? That doesn't support custom column spans. If not, help me with an expo sample and I can fix it for you.
Any chance we can support this, even haphazardly, in Masonry mode?
Current behavior
Header on the same line as an item, that is really bad
[](url)
Code from an example in official documentation, and added some props to make two columns
Expected behavior
Header is not located on the same line like an item. UI structure must be something like this:
Header Item item Item Item ... .... Item item
Header Item item Item item .... .... Item item
To Reproduce
Run code
Platform:
Environment
"react-native": "0.67.4",
"@shopify/flash-list": "1.2.2",