How can I insert a line break into a <Text> component in React Native?

I want to insert a new line (like \r\n, <br />) in a Text component in React Native.

If I have:

<text>
<br />
Hi~<br />
this is a test message.<br />
</text>

Then React Native renders Hi~ this is a test message.

Is it possible render text to add a new line like so:

Hi~
this is a test message.

This should do it:

<Text>
Hi~{"\n"}
this is a test message.
</Text>

You can also do:

<Text>{`
Hi~
this is a test message.
`}</Text>

Easier in my opinion, because you don't have to insert stuff within the string; just wrap it once and it keeps all your line-breaks.


Use:

<Text>{`Hi,\nCurtis!`}</Text>

Result:

Hi,

Curtis!


This worked for me

<Text>{`Hi~\nthis is a test message.`}</Text>

(react-native 0.41.0)