react native text breaks word in the middle

Viewed 2203

I show text in a react native Text component, within several, nested View components.
I retrieve this text from a service, that I call.
The text varies per call.
In some cases, react native (both iOS and android) automatically breaks the text, in the middle of a word.
example: i have a d
og

how can I force react native to keep words together / to only do a line-break between words?

2 Answers

To Break the Text

<View style={styles.container}>
  <Text style={styles.paragraph}>
   Hello This is an example of 
   {'\n'}
   multiline text
</Text>
  <Text style={styles.paragraph}>{`Here is an other way to 
     set multiline text.`}</Text>
 </View>

we found a solution: we filter out non-breaking spaces in the front end. we don't know how/where the spaces in our content (imported into our database and retrieved in the front end using a backend service) are converted to non-breaking spaces.

Related