0
私はexpoのドキュメントにあるこのコードを使用しようとしています。私は既にイメージとフォントを含んでいましたが、予想通りイオニコンフォントの行に奇妙なエラーが表示されていました。正しいのですが。何が間違っているのか分からないのですか?私は、EXPOの例を使用してアプリケーションを構成しようとしていますが、構文エラーが表示されます。
function cacheImages(images) {
return images.map(image => {
if (typeof image === 'string') {
return Image.prefetch(image);
} else {
return Asset.fromModule(image).downloadAsync();
}
});
}
function cacheFonts(fonts) {
return fonts.map(font => Font.loadAsync(font));
}
export default class App extends React.Component {
constructor() {
super();
this.state = {
isReady: false,
store: configureStore(() => this.setState({ isLoading: false })),
mainApplication: false,
};
}
async _loadAssetsAsync() {
const imageAssets = cacheImages([
require("./assets/icons/app.png"),
require("./assets/icons/loading.png"),
require("./img/img1.jpg"),
require("./img/img2.jpg"),
require("./img/img3.jpg"),
]);
const fontAssets = cacheFonts([
Ionicons: require("@expo/vector-icons/fonts/Ionicons.ttf"),
Arial: require("native-base/Fonts/Roboto.ttf"),
Roboto: require("native-base/Fonts/Roboto.ttf"),
Roboto_medium: require("native-base/Fonts/Roboto_medium.ttf"),]);
await Promise.all([...imageAssets, ...fontAssets]);
}
render() {
if (!this.state.isReady) {
return (
<AppLoading
startAsync={this._loadAssetsAsync}
onFinish={() => this.setState({ isReady: true })}
onError={console.warn}
/>
);
}
else {
return (
return <Provider store={this.state.store}>
<Root>
<Nav/>
</Root>
</Provider>;
);
}
}
このコードで何が問題なのですが、どうすれば修正できますか?
質問に正確なエラーを追加できますか? – Marco
構文エラーexpectec '; 'on the line Ionicons:require( "@exo/vector-icons/fonts/Ionicons.ttf")、 – Artyom