Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

React Native – wrap Text in a View

I have the following code, and I want multiple <Text> in a <View> to become one consecutive paragraph. But when displayed on the App, they appear below the line.
(Because I need to use Tooltip, I need to use multiple <Text> in one <View>)

Source code:

<View style={{flex:1, width:'100%', flexDirection: 'row', flexWrap: 'wrap', padding: 10}}>
  <Text>{'放棄行政工作。'}</Text>
  <Text>{'退守分析預測的。'}</Text>
  <Text>{'把AI當作同事,形成協同合作的團隊。'}</Text>
  <Text>{'多琢磨在創造力以及各種流程架構設計師角色。'}</Text>
  <Text>{'強化自己人際網路、溝通協調、談判上的能力。'}</Text>
</View>

run:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

display that I desire:

enter image description here

>Solution :

Embed your text components in a parent Text to make them part of the same line.

<View style={{flex:1, width:'100%', flexDirection: 'row', flexWrap: 'wrap', padding: 10}}>
  <Text>
    <Text>{'放棄行政工作。'}</Text>
    <Text>{'退守分析預測的。'}</Text>
    <Text>{'把AI當作同事,形成協同合作的團隊。'}</Text>
    <Text>{'多琢磨在創造力以及各種流程架構設計師角色。'}</Text>
    <Text>{'強化自己人際網路、溝通協調、談判上的能力。'}</Text>
  </Text>
</View>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading