export const SomeText = styled(Text)`
font-family: "Arial", sans-serif;
`
export const SomeText = styled(Text)`
font-family: Arial, sans-serif;
`
export const SomeText = styled(Text)`
font-family: "Arial, sans-serif";
`
以上所有错误。
示例错误:Error: Failed to parse declaration "fontFamily: "Arial", sans-serif"
哪种是通过样式化组件在React Native中应用字体家族的正确方法?
答案 0 :(得分:0)
移动平台的系统字体与浏览器的系统字体不同。您可以在此处找到列表:https://github.com/react-native-training/react-native-fonts
如果您希望代码依赖于可用的系统字体,则可以使用如下代码:
${Platform.select({ ios: css`font-family: Helvetica`, android: css`font-family: Roboto` })};
(参考此处:https://github.com/styled-components/styled-components/issues/1058)