48

I want to create Text components and to display them in a row , like span elements in html. If i'm doing it this way:

<View>
  <Text> Start here, </Text> <Text> finish here </Text>
</View>

line is broken between them and it looks like:

Start here,
finish here

How can i prevent line breaking and display them on the same line?

Ivan Chernykh
  • 41,617
  • 13
  • 134
  • 146

2 Answers2

96

Just set the correct flexDirection. Default is column.

<View style={{flexDirection: 'row'}}>
 <Text> Start here, </Text> <Text> finish here </Text>
</View>
purii
  • 6,246
  • 2
  • 26
  • 32
37

Text components are inline when wrapping them with another Text element, like:

<Text>
   <Text>We</Text><Text>Are</Text><Text>Inline</Text>
</Text>
Ivan Chernykh
  • 41,617
  • 13
  • 134
  • 146