I tried using a custom font Avenir-book.tff and AvernirNext.otf for my expo project. For some reason my custom font works in my iOS device but doesn't work for my android device. Here my code: app.js:
UNSAFE_componentWillMount() {
Font.loadAsync({
"Avenir-Book": require("./assets/fonts/Avenir-Book.ttf"),
"Avenir-Next": require("./assets/fonts/AvenirNextLTPro-Bold.otf"),
}).then(() => this.setState({ fontsLoaded: true }));
}
my text:
<Text style={styles.text}>ORA</Text>
Style sheet:
text: {
color: colors.white,
fontSize: 30,
fontFamily: "Avenir-Book",
fontWeight: "bold",
marginTop: 8,
},
I tried using both the fonts. Both works perfectly fine on iOS but doesn't work at all on android. Does anyone know why?
I think this answer is relevant: https://stackoverflow.com/a/62460424/659988
Be sure to refer to this minimal and complete working example in the documentation too: https://docs.expo.io/guides/using-custom-fonts/#a-minimal-but-complete-working-example
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.