为了账号安全,请及时绑定邮箱和手机立即绑定

React Native(Expo)如何设置默认字体(或者是全局字体)?

React Native(Expo)如何设置默认字体(或者是全局字体)?

UYOU 2019-03-14 22:19:06
React Native(Expo)如何设置默认字体(或者是全局字体)?如果自定义一个Text组件, 可能要异步加载,如下:  componentWillMount = async () => {    await Font.loadAsync({      'a: require('../fonts/aaa.ttf'),      'b': require('../fonts/bbb.ttf')    });    this.setState({ fontLoaded: true });  };那么可能会出现如下错误:Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 486 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信