反应原生的fontVariant的预期格式是什么

时间:2018-02-27 21:26:39

标签: react-native

我正在尝试在文字样式上使用fontVariantdocumentation表示它需要一个“枚举数组”。这在json中看起来怎么样?我已经尝试传递一个字符串,并且在android上忽略在android 上工作,但在ios上抛出错误:

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

将抛出:

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

我使用版本0.53.3 react-native

1 个答案:

答案 0 :(得分:0)

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

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