I am building multi lines horizontal list using [array & flexGrow].
My list have different size of text like:['aaaaa','aa','aaaaaaaaaaa','aaaaaaaa'].
I want when the views wrapped to second row and next view will wrapped into third row, then show other.. view.
My code:
const services=['aaaaa','aa','aaaaaaaaaaa','aaaaaaaa'];
<View style={styles.servicesHView}>
{services?.map(item => {
return (
<View style={styles.servicesView}>
<Text style={styles.serviceText}>{item}</Text>
</View>
);
})}
</View>
Style:
servicesHView: {
marginTop: hp('2%'),
flexDirection: 'row',
flexWrap: 'wrap' ,
},
servicesView: {
paddingVertical: hp('1%'),
paddingHorizontal: wp('4%'),
marginEnd: wp('2%'),
backgroundColor: colors.semiDarkGray,
borderRadius: 15,
marginBottom: hp('0.8%'),
},
serviceText: {
fontFamily: 'Nunito_SemiBold',
fontSize: wp('4%'),
color: colors.darkGray,
alignSelf: 'center',
},
I want the result like that:
But my result is:

