如何在React Native中使用fontFamily props设置一组字体?

时间:2017-12-11 11:12:59

标签: react-native font-family

在css中,我们可以像这样设置:

font-family:"Times New Roman",Georgia,Serif;

但是在RN中,我们可以设置一种字体,

fontFamily: 'MidPlane00v3.1',

我们如何像css一样使用它? 我需要使用字体回滚机制显示多个字节的中文单词!

2 个答案:

答案 0 :(得分:0)

在React中,您可以使用以下语法设置多个字体系列:

fontFamily: '"Times New Roman", Georgia, Serif'

示例:

const cardStyle = {
  fontFamily: '"Times New Roman", Georgia, Serif',
  fontSize: '6rem',
  fontWeight: 300,
  letterSpacing: '-0.01562em',
  lineHeight: 1
};

答案 1 :(得分:-1)

在React Native中,他们对此更严格:你必须将所有文本节点包装在组件内。

在此官方文档中查看您的答案:Offical Doc

import { CollapseProps } from 'antd/lib/collapse/Collapse';

Refernce