Shmily
Shmily

Reputation: 55

How to make 2 <Text> inline in React Native

I want to make 2 in one line, one flex-end and one flex-start, but I am not able to make it inline after applying flex-end and flex-start to the two separately. Anyone have idea how to do this?

<View style={{flexDirection: 'row'}}>
   <Text style={{alignSelf: 'flex-start'}}>Line 1</Text>
   <Text style={{alignSelf: 'flex-start'}}>Line 2</Text>
</View>

Upvotes: 0

Views: 642

Answers (1)

Ravi
Ravi

Reputation: 35589

Just use justifyContent:'space-between' and you are done, no need to use anything in Text

<View style={{flexDirection: 'row', justifyContent:'space-between'}}>
   <Text>Line 1</Text>
   <Text>Line 2</Text>
</View>

Upvotes: 1

Related Questions