当前位置: 首页 > 工具软件 > ionicons > 使用案例 >

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

颛孙兴旺
2023-12-01

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

转载于:https://www.cnblogs.com/Macros/p/7867574.html

 类似资料: