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

djp7away  于 2022-12-14  发布在  React
关注(0)|答案(2)|浏览(160)

这里有点问题..长话短说,我想在我的项目中实现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
v1l68za4

v1l68za41#

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

von4xj4u

von4xj4u2#

删除Android中的自定义字体:

Navigate to android/app/src/main/assets/fonts

删除文件中的字体。

删除iOS中的自定字体:

Navigate to ios/{project-name}/info.plist

删除文件中的字体。

相关问题