Reputation: 5845
I have a text element inside a view:
<View><Text>hello world foo bar</Text></View>
as part of a flex grid.
I want this view to have an auto width based on the content i.e. length of the text.
How do I achieve this?
Upvotes: 27
Views: 23064
Reputation: 33
you can always set minWidth: some width
and then align it to the center
Upvotes: 0
Reputation: 42166
You can achieve this if element will have alignSelf
property, like:
alignSelf: 'flex-start'
or
alignSelf: 'center'
Upvotes: 64