Reputation: 2262
I want to achieve something simillar to this:
The effect is similar to UICollectionView from Swift with self sizing cells.
How should I go implementing this in React Native?
Setting numColumns
will not achieve the desired effect as I need a dynamic number of cells per row. That would limit me to the value of numColumns
. There should be as many items per row as there can fit. If no more can fit on that row, then add to the next row.
Thanks!
Upvotes: 2
Views: 1540
Reputation: 3610
you can try to use the flexWrap
style. and set the text view a fixed height. the width is auto.
<View style={[{flexDirection: 'row', flexWrap: ' wrap'}]}>
data.map(element => {
return <Text style={{height:100}}>element.content</Text>
})
</View>
Upvotes: 2