【问题标题】:How to use fontStyle on IOS? (with React-Native)如何在IOS上使用fontStyle? (使用 React-Native)
【发布时间】:2019-12-06 01:28:46
【问题描述】:

我尝试在IOS上使用“粗体”、“斜体”等书写方式,但遇到以下错误:

Invalid RCTFontStyle 'bold'. should be one of: (
italic,
normal,
oblique
)

当我在 IOS 上构建时,我应该更改什么以不再出现错误?

我不明白,因为在 android 上,当我使用 fontStyle: 'bold' 时,我没有错误并且一切正常。我是新手,非常感谢任何帮助和简单的解释。

【问题讨论】:

    标签: javascript ios react-native build fonts


    【解决方案1】:

    fontWeight 应该是应用 bold 样式的正确道具。

    fontStyle: enum('normal', 'italic')
    fontWeight: enum('normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900')
    

    documentation

    【讨论】:

      【解决方案2】:

      只需使用 fontWeight 代替。

      fontWeight: 'bold'
      

      fontWeight: 500;
      

      【讨论】:

      • 这解决了我的问题,非常感谢您的帮助。 =)
      猜你喜欢
      • 1970-01-01
      • 2018-12-25
      • 2017-01-02
      • 1970-01-01
      • 2017-11-28
      • 1970-01-01
      • 1970-01-01
      • 2022-10-06
      • 1970-01-01
      相关资源
      最近更新 更多