在 React-Native 中使用自定义字体 [英] Use custom-font in React-Native

查看:49
本文介绍了在 React-Native 中使用自定义字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用中使用自定义字体,但我一直收到错误

I would like to use custom font in my app, but I keep getting error

[RCTLog][tid:0x78f70450][RCTConvert.m:581]>Unrecognized font family 'Roboto'

这是否意味着我必须弄乱iOS直接导入字体的方式?

Does this mean I have to mess with the iOS's way to import font directly?

推荐答案

那是因为 iOS 默认没有可用的 Roboto 字体.

That's because iOS does not have the Roboto font available by default.

没错.要使其可用,您必须从 Xcode 将其包含在您的项目中.只需按照此答案提供的步骤操作即可,非常简单.

Exactly. To make it available you have to include it in your project from Xcode. Just follow the steps that this answer provides, it's pretty straightforward.

一旦你这样做了,那么你在 JS 中使用它应该没有问题.

Once you have done this, then you should have no problem using it from JS.

这篇关于在 React-Native 中使用自定义字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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