gpt4 book ai didi

react-native - react native中fontVariant的预期格式是什么

转载 作者:行者123 更新时间:2023-12-04 05:24:56 27 4
gpt4 key购买 nike

我正在尝试使用 fontVariant在文本样式上。 documentation说它需要一个“枚举数组”。这在 json 中看起来如何?我试过传递一个字符串,它在 android 上工作在 android 上被忽略,但在 ios 上抛出一个错误:

<Text style={{ fontVariant: 'small-caps' }}>some text</Text>

会抛出:

NSString 类型的 JSON 值“small-caps”无法转换为 NSArray

我使用的是 0.53.3 版本的 react-native

最佳答案

According to the source PropTypes ,它需要一个与枚举匹配的字符串数组:

<Text style={{ fontVariant: [ 'small-caps' ] }}>some text</Text>

关于react-native - react native中fontVariant的预期格式是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49018197/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com