Curtis Curtis - 6 months ago 443
Javascript Question

How can I insert new line(\r\n) in react-native text component?

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

When i write

<text>

Hi~

this is a test message.

</text>

But react-native shows to me :

'Hi~ this is a test message.'

Is there possible print like this?

'Hi~

this is a test message.'

Answer

I cannot test it right now but this should do it:

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

Demo here

Comments