Hey guys,
I have made a font set using fontello. used that set already on regular react native project with different approach.
but now with expo when I try to load it, it says “fontFamily “fontello” is not a system font and has not been loaded through Font.loadAsync”
I have followed the docs. and tried even follow other tuts. but none.
this is my code:
import React, {Component} from 'react';
import { View, Text,StyleSheet } from 'react-native';
import { Font, AppLoading } from 'expo';
export default class Icon extends Component {
state = {
iconDidLoad: false
}
async componentDidMount() {
await Font.loadAsync({
fontello: require('../../assets/fonts/fontello.ttf')
});
this.setState({iconDidLoad: true});
}
render() {
if (!this.state.iconDidLoad) {
<AppLoading/>
}
return <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={styles.icon}>{this.props.code}</Text>
</View>
}
}
const styles = StyleSheet.create({
icon: {
color: 'black',
fontFamily: 'fontello',
fontSize: 16
}
})
what am I missing?
Thanks!