小编Pul*_*hne的帖子

将自定义字体添加到 React Native 应用程序 - 版本 > 0.60

我正在使用 React Native (V-0.64)。我使用的方法是下载自定义字体并将其添加到资产文件夹中,然后创建一个react-native.config.js文件并从那里导出链接。但当我在设备上运行该应用程序时,我不断收到以下错误。文件中的代码

module.exports = {
  assets: ['./assets/fonts'],
};
Run Code Online (Sandbox Code Playgroud)

然后运行npx react-native link将资产链接到 android 和 iOS 文件中。但我不断在行中收到以下错误,并且没有在文本中更改字体

fontFamily "VeganStylePersonalUse-5Y58" is not a system font and has not been loaded through Font.loadAsync.

- If you intended to use a system font, make sure you typed the name correctly and that it is supported by your device operating system.

- If this is a custom font, be sure to load it with Font.loadAsync.
at node_modules/expo-font/build/Font.js:27:16 in processFontFamily
at …
Run Code Online (Sandbox Code Playgroud)

android ios reactjs react-native

1
推荐指数
1
解决办法
2117
查看次数

标签 统计

android ×1

ios ×1

react-native ×1

reactjs ×1