1、react-native中expo的真机测试字体不加载的坑

react

native-base的字体问题Roboto_medium


把native-base中的Fonts文件夹放到项目的根目录.

import {Font,AppLoading} from 'expo';

import {Root} from 'native-base';

export default class App extends React.Component {

constructor(){

super();

this.state={

loading:true

}

}

async componentWillMount() {

await Expo.Font.loadAsync({

'Roboto': require('./Fonts/Roboto.ttf'),

'Roboto_medium': require('./Fonts/Roboto_medium.ttf'),

});

this.setState({

loading:false

});

}

render() {

if(this.state.loading){

return (

<Root>

<AppLoading/>

</Root>

)

}

return ()

}

以上是 1、react-native中expo的真机测试字体不加载的坑 的全部内容, 来源链接: utcz.com/z/381274.html

回到顶部