Macros

给我一支烟!请所有烦恼都能过往如云烟!

导航

fontFamily 'Ionicons' is not a system font and has not been loaded through Expo.Font.loadAsync的问题

import * as React from "react";
import { Provider } from "mobx-react/native";
import { StyleProvider } from "native-base";

import App from "../App";
import getTheme from "../theme/components";
import variables from "../theme/variables/platform";
export interface Props {}
export interface State {}
export default function(stores) {

return class Setup extends React.Component<Props, State> {

constructor() {
super();
this.state = {
readyFlag: false,
};
}
async componentWillMount() {
await Expo.Font.loadAsync({
'Ionicons': require('@expo/vector-icons/fonts/Ionicons.ttf'),
});
this.setState({ readyFlag: true });
}
render() {
if (!this.state.readyFlag) {
return <Expo.AppLoading />;
}
return (
<StyleProvider style={getTheme(variables)}>
<Provider {...stores}>
<App />
</Provider>
</StyleProvider>
);
}
};
}

posted on 2017-11-20 18:08  Macros  阅读(1178)  评论(0编辑  收藏  举报