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

时间:2021-08-31 23:11:35

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>
);
}
};
}