react-native 无法识别的字体系列 FontAwesome5Pro-Solid [英] react-native unrecognized font family FontAwesome5Pro-Solid

查看:46
本文介绍了react-native 无法识别的字体系列 FontAwesome5Pro-Solid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 react-native-vector-icons 作为图标

I use react-native-vector-icons for icons

import Icon from 'react-native-vector-icons/FontAwesome5Pro'

我将所有 FontAwesome 网络字体放入 assets/fonts 并将此文件夹添加到 package.json 中的 rnpm 部分

All FontAwesome web fonts I put to assets/fonts and add this folder to rnpm section in package.json

"rnpm": {
    "assets": [
      "./assets/Fontawesome/webfonts/"
    ]
}

然后我运行 react-native link

Then I run react-native link

我在 info.plist 中看到的所有这些字体,但是当

All this fonts I see in info.plist but when

<Icon name="user" solid />

我看到错误无法识别的字体系列 FontAwesome5Pro-Solid.这很有趣,但在我的旧 macbook 上一切正常,我只是克隆我的存储库并运行项目,然后出现此错误...

I see error unrecognized font family FontAwesome5Pro-Solid. It's funny, but on my old macbook all works fine, I just clone my repository and run project and this error appeared...

我可以尝试什么来解决这个问题?

What can I to try to solve this?

推荐答案

我发现了问题.似乎 FontAwesome5Pro-Solid 字体要么 缺失react-native-vector-icons.

I found the problem. It seems that FontAwesome5Pro-Solid fonts are either missing are broken in version 6.4.X of react-native-vector-icons.

所以,为了解决这个问题,我必须在我的 package.json 文件中恢复到以前的版本:

So, to fix this problem I had to revert back to a previous version in my package.json file:

"react-native-vector-icons": "6.3.0",

删除版本前面的 ^ 也很重要,这样它就不会更新到最新版本.维护者知道问题,并且应该很快修复.

It is important to also remove the ^ in front of the version so that it does not update to the latest version. The maintainer is aware of the problem, and it should be fixed soon.

这篇关于react-native 无法识别的字体系列 FontAwesome5Pro-Solid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆