【问题标题】:Interspace between text Lines in React nativeReact Native中文本行之间的间隔
【发布时间】:2017-08-01 01:14:10
【问题描述】:

我需要在 Android 和 iOS 的 React Native 中更改文本中的行间距。 这是样式页面中的代码:

text: {
  color: '#C0C0C0',
  fontSize: 18,
  textAlign: 'justify',
}

【问题讨论】:

    标签: text react-native


    【解决方案1】:

    使用lineHeight -

      text: {
        color: '#C0C0C0',
        fontSize: 18,
        textAlign: 'justify',
        lineHeight: 30,
      },
    

    【讨论】:

    • 请注意,嵌套的 Text 组件似乎没有继承 lineHeight
    • 感谢这个不错的解决方案,而不是编写自定义文本组件。
    • 在我的按钮情况下它不起作用。请帮助
    【解决方案2】:

    你可以使用

    {'\n'}
    

    在您的文本标签内

    示例:

    <Text>{'\n'} Heading : </Text>
    

    【讨论】:

      猜你喜欢
      • 2018-01-16
      • 2017-11-24
      • 2018-01-12
      • 1970-01-01
      • 2018-11-17
      • 1970-01-01
      • 2019-03-31
      • 2021-08-19
      • 1970-01-01
      相关资源
      最近更新 更多