When I attempt to add fonts into the font assets array I’m receiving and error. Is there another way to accomplish this with cacheFonts and assign a name?
The error I receive is just related to an unexpected token “,” so I assume this is because of the :
Hey Thanks Jimmy. I was able to get past that block with the correct syntax like you suggested. It appears now that the async call is never being made.
If I do a log on the error I see it being called.
render() {
if (!this.state.isReady) {
console.log("LOADING ", this.state.isReady);
return (
<AppLoading
startAsync={this._loadAssetsAsync}
onFinish={() => this.setState({ isReady: true })}
onError={console.log("ERROR IN APP LOADING")}
/>
);
}
return <App />
}
// THIS DOES NOT WORK FOR SOME REASON
async _loadAssetsAsync() {
/*const imageAssets = cacheImages([
require('./assets/images/exponent-wordmark.png'),
'http://www.google.com/logo.png',
]);
*/
console.log("_loadAssetsAsync");
const fontAssets = cacheFonts({
'QuioIcons': require('./assets/icons/icomoon.ttf'),
'RobotoCondensed-Bold': require('./assets/fonts/RobotoCondensed-Bold.ttf'),
'RobotoCondensed-Regular': require("./assets/fonts/RobotoCondensed-Regular.ttf"),
'Roboto-Italic': require("./assets/fonts/Roboto-Italic.ttf"),
'Roboto-Light': require("./assets/fonts/Roboto-Light.ttf"),
'Roboto-Medium': require("./assets/fonts/Roboto-Medium.ttf"),
'Roboto-Regular': require("./assets/fonts/Roboto-Regular.ttf")
});
await Promise.all([
//...imageAssets,
...fontAssets,
]);
}
hey @dekm, from your post, it seems like _loadAssetsAsync is getting run because you said the console.log is getting run. If the issue is that you dont think await Promise.all... is getting run, how do you know this?
The log console.log(“_loadAssetsAsync”); never gets called. It’s the onError={console.log(“ERROR IN APP LOADING”)} log that get’s called. So no idea why this does not work. Every other method I tried gives me an error the fonts are not loaded yet.