I am using a flatlist to create a grid of items containing images, videos, blogs and audios. There are two columns in the flatlist. I have added a button to add dummy posts in flatlist. Problem is the height of items. When i add a blog in flatlist , it has text, images in it and item beside it . i.e image or video also gets the height of the blog item. Is it possible to give variable height to every item in row. On adding blog to the flatlist video item has also taken height qual to the blog item.
React-native – Flatlist row with items of different size
react-nativereact-native-flatlist
Best Answer
According to official document, when flatlist has multy cols,
Items should all be the same height - masonry layouts are not supported.
But I think you can try to add a wrapper
View
on each column item to avoid this rule. The flatlist'sheight
will be set on the wrapper, your item's height can still config by you.