如何在 IOS 上使用 fontStyle? (使用 React-Native)

How to use fontStyle on IOS? (with React-Native)

我正在尝试在 IOS 上使用 "bold"、"italic" 的写作风格,但遇到以下错误:

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

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

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

只需使用 fontWeight 即可。

fontWeight: 'bold'

fontWeight: 500;

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

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

参见documentation