javascript - React Native 多行文本缩进

标签 javascript react-native expo

在 React Native 中,由于文本的长度,在 Text 组件中会自动换行。自动换行后如何保持所需的缩进?
Text Indentation on React Native
这个问题回答了如何使用文本组件创建缩进,但没有解决像 user3191334 询问的多行缩进。
例如,如果我们使用单行缩进

<Text>{'\t'}Hello, my name is John.</Text>
移动屏幕上的输出可能是:
     Hello, my name is 

 John. 
我想这样做,所以输出是:
     Hello, my name is

     John.

最佳答案

添加 paddingLeft文本样式中的属性。这是一个例子

<Text style={{paddingLeft:100}}>this is just and example </Text>

关于javascript - React Native 多行文本缩进,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68674913/

相关文章:

javascript - 如何使用 jQuery 将多维字符串数组转换为 float ?

javascript - 如何在 ng-repeat 循环中初始化输入复选框的 ng-model

react-native - 运行expo start时如何禁用在浏览器中打开DevTools?

android - 使用react-native-auth0快速启动,无需AndroidManifest.xml

react-native - 尝试重置导航会引发错误

javascript - 我正在尝试使用 div 名称作为变量来打开和关闭多个按钮的 div

javascript - Angular 用户界面路由器不工作/路由

react-native - TypeError : this. state.data.map 不是函数

react-native - 如何用 jest 模拟 react-native 模块(不是 3rd 方模块)

xcode - Expo 未加载 (React-Native) -- 空 Expo SDK 版本