在使用 import Native Base 时(因为它来了),我遇到了问题,因为屏幕中显示了字体错误。如果您单击关闭它会消失,但用户无法在每次加载文本时看到它。¿是否有解决字体问题的正确方法?
这个官方文档说要这样做:
// At the top of your file
import { Font } from 'expo';
import { Ionicons } from '@expo/vector-icons';
// Later on in your component
async componentDidMount() {
await Font.loadAsync({
'Roboto': require('native-base/Fonts/Roboto.ttf'),
'Roboto_medium': require('native-base/Fonts/Roboto_medium.ttf'),
...Ionicons.font,
});
}
Run Code Online (Sandbox Code Playgroud)
但它没有用。这是我的代码:
import React, { Component } from 'react';
import { View, } from "react-native";
import { Button, Text } from 'native-base';
export default class MyComponent extends Component {
render() {
return (
<View>
<Button>
<Text>Click …Run Code Online (Sandbox Code Playgroud)