React Native Multi Line Text Indentation

Viewed 633

In React Native, the line breaks automatically in the Text component due to the length of the text. How do I keep the desired indentation after an automatic line break?

Text Indentation on React Native

This question answers how to create indentation using the text component, but does not address multi line indentation like user3191334 asked about.

For example, if we used single line indentation

<Text>{'\t'}Hello, my name is John.</Text>

The output on a mobile screen could be:

     Hello, my name is 

 John. 

I would like to make it so the output is:

     Hello, my name is

     John.
2 Answers

add paddingLeft property in the text style. Here is an example

<Text style={{paddingLeft:100}}>this is just and example </Text>

You can use /n for break line

<Text>
   Hi{'\n'}
   this is a test message.
</Text>
Related