Hi,
I recently detached SDK 30. I’m trying to load in fonts and icons for async caching. Here is my file below:
App.js
import React, { Component } from "react";
import { Font, Asset, AppLoading } from "expo";
Asset;
import { Platform } from "react-native";
import { Provider } from "mobx-react";
import LoadingScreen from "./src/app/Common/Loading";
import Router from "./src/app/Router/RootNavigator";
import stores from "./src/app/Stores";
export default class App extends Component {
state = {
isSplashReady: false,
isAppReady: false
};
handleAppCache = () => {
console.log("CALLED");
setTimeout(() => this._cacheResourcesAsync(), 1500);
};
render() {
if (!this.state.isSplashReady && !this.state.isAppReady) {
return (
<AppLoading
startAsync={this._cacheSplashResourcesAsync}
onFinish={() => this.setState({ isSplashReady: true })}
onError={console.warn}
autoHideSplash={true}
/>
);
} else if (this.state.isSplashReady && !this.state.isAppReady) {
return <LoadingScreen onLoad={this.handleAppCache} />;
} else {
return (
<Provider {...stores}>
<Router />
</Provider>
);
}
}
async _cacheSplashResourcesAsync() {
await Asset.fromModule(
require("./src/assets/images/app_icon.png")
).downloadAsync();
}
async _cacheResourcesAsync() {
const images = [
require("./src/assets/images/card_feature.png"),
require("./src/assets/images/stripe_logo.png")
];
const cacheImages = images.map(image => {
return Asset.fromModule(image).downloadAsync();
});
await Promise.all([cacheImages]);
this.setState({ isAppReady: true }, () => console.log("app ready"));
}
}
Every time Fonts.loadAsync runs, I get the following error:
[Error: File ‘file:///Users/nfrush/Library/Developer/CoreSimulator/Devices/F5B2D02F-6720-4518-8733-ECBC119849AC/data/Containers/Bundle/Application/15D182F9-8A8C-4AEE-9FA7-070AC201F37F/live_chair.app/asset_74c652671225d6ded874a648502e5f0a.ttf’ for font ‘396AB874-F610-4D25-878E-5C0045A92AB1-Ionicons’ doesn’t exist]
I also can’t see my icons on both iOS and Android I just want to be able to use some icons. So any help is appreciated. This was working flawless in SDK 26 (this is a new repo however).