android - React Native: Get flexDirection row items to render on next render if outside of view's boundaries -
i have view container containing multiple view
tags using flexdirection: 'row'
property. however, issue arises when have many elements in container view
. reasons, view
components inside container don't wrap , overflow outside container. see image here
you can see view container has border, contents flowing outside of it.
my render function
render() { let test = ["acute pain","acute pain","acute pain","acute","acute","acute","acute"] let tagnames = test.map((tagname, index) => { return ( <view style={{backgroundcolor: '#1bb393', padding: 3, borderradius: 5, marginright: 5}}> <text style={{color: 'white', fontfamily: 'facit'}}>{tagname}</text> </view> ) }) return ( <view style={{flexdirection: 'row', flex: 1, borderwidth: 1}}>{tagnames}</view> ) }
you should use flexwrap: 'wrap'
. render
function must this:
return ( <view style={{flexdirection: 'row', flex: 1, borderwidth: 1, flexwrap: 'wrap'}}>{tagnames}</view> )
Comments
Post a Comment