如何在 React Native 中的文本中插入选项卡
问题描述:
我想在文本之前的 react native 文本中插入一个制表符.我尝试了各种方法,但无法做到.有没有办法通过使用换行符\n"之类的代码来做到这一点
I want insert a tab to a text in react native before text. I tried in various ways but couldn't do it.Is there a way to do it by using a code like line break "\n"
<View> <Text>I want to shift this text right</Text> </View>
答
我的做法是在 JSX 文本组件中使用 javascript 字符串.这样你就可以用编程方式"编写字符串了.
The way i do it is using a javascript string inside the JSX Text component. This way you can write strings the "programming way".
<Text>{`\tI want to shift this text right`}</Text>