Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 views
in Technique[技术] by (71.8m points)

javascript - 如何将换行符插入 <Text> React Native中的组件?(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.(我想在React Native的Text组件中插入新行(例如\ r \ n,<br />)。)

If I have:(如果我有:) <text><br /> Hi~<br > this is a test message.<br /> </text> Then React Native renders Hi~ this is a test message.(然后React Native渲染Hi~ this is a test message.) Is it possible render text to add a new line like so:(是否有可能像这样渲染文本以??添加新行:) Hi~ this is a test message.   ask by Curtis translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This should do it:(应该这样做:)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...