Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async componentWillMount() {
await Font.loadAsync({
// 'Ionicons': require('native-base/Fonts/Ionicons.ttf'),
...Ionicons.font,
...FontAwesome.font,
...AntDesign.font,
'Font-Light': require('./app/assets/fonts/Montserrat-Light.ttf'),
'Font-Regular': require('./app/assets/fonts/Montserrat-Regular.ttf'),
'Font-Semibold': require('./app/assets/fonts/Montserrat-SemiBold.ttf'),
'Font-Bold': require('./app/assets/fonts/Montserrat-Bold.ttf'),
});
this.setState({isReady: true});
}
async _loadAssetsAsync() {
try {
await cacheAssetsAsync({
images: [require('./assets/images/expo-wordmark.png')],
fonts: [
FontAwesome.font,
{ 'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf') },
{ 'Roboto': require("native-base/Fonts/Roboto.ttf") },
{ 'Roboto_medium': require("native-base/Fonts/Roboto_medium.ttf") },
],
});
} catch (e) {
console.warn(
'There was an error caching assets (see: main.js), perhaps due to a ' +
'network timeout, so we skipped caching. Reload the app to try again.'
);
console.log(e.message);
} finally {
this.setState({ appIsReady: true });
}
}
async _loadAssetsAsync() {
const imageAssets = this._cacheImages([
require('./assets/videoplayer/thumb.png'),
require('./assets/videoplayer/track.png'),
]);
const fontAssets = this._cacheFonts([
fonts,
EvilIcons.font,
FontAwesome.font,
Ionicons.font,
MaterialIcons.font,
Foundation.font,
]);
try {
await Promise.all([
Store.rehydrateAsync(),
...imageAssets,
...fontAssets,
]);
Store.dispatch({ type: 'SET_DATA', data: Data });
} catch (e) {
console.log('Error downloading assets', e);
Sentry.captureException(e);
}