需要在React Native中删除自定义字体的帮助

时间:2019-11-14 20:48:25

标签: react-native expo

这里有点问题。长话短说,我想在我的项目中实现Roboto字体,但我无法做到(未能实现loadAsync)。因此,我删除了所有指向Roboto的引用,启动了我的项目,这就是我收到的消息。

  • 尝试删除node_modules并启动npm安装-无效
  • 尝试使用VSCode中的搜索在文件夹中搜索Roboto-没有导致Roboto的线索也尝试了其他一些操作,尽管现在无法重新命名它们。.

如果您能在这里帮助我,花了很多时间试图解决此问题,将不胜感激。

console.error: "fontFamily "Roboto_medium" 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."
__expoConsoleLog
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\expo\build\logs\RemoteConsole.js:80:37
error
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\YellowBox\YellowBox.js:59:8
error
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\expo\build\environment\muteWarnings.fx.js:27:24
processFontFamily
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\expo-font\build\Font.js:35:16
diffProperties
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:3545:38
diffProperties
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:3556:8
createInstance
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:4003:29
completeWork
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:14437:12
completeUnitOfWork
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:17094:10
performUnitOfWork
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:17304:30
workLoop
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:17316:41
renderRoot
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:17417:15
performWorkOnRoot
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:18423:17
performWork
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:18324:24
performSyncWork
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:18285:14
requestWork
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:18169:19
scheduleWork
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:17969:16
scheduleRootUpdate
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:18642:15
render
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:19512:20
renderApplication
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\ReactNative\renderApplication.js:61:52
run
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\ReactNative\AppRegistry.js:104:10
runApplication
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\ReactNative\AppRegistry.js:198:26
__callFunction
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:366:47
<unknown>
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:106:26
__guard
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:314:10
callFunctionReturnFlushedQueue
    C:\Users\Jonas\desktop\galbutveiksdabar\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:105:17

1 个答案:

答案 0 :(得分:0)

出于性能原因,您尝试加载的字体存储在缓存中。因此,大多数时候我遇到类似的问题是因为这些资产仍在缓存中。您可以使用以下命令清理expo缓存:

expo r -c