I usually use the next pattern:
- for iOS
fontWeight+fontFamily
- but for Android
fontFamily
is a filename of font
export const fonts = {
semibold: Platform.select({
ios: { fontWeight: '600', fontFamily: 'Graphik LC' },
android: { fontFamily: 'Graphik LC_semibold' },
}),
bold: Platform.select({
ios: { fontWeight: '700', fontFamily: 'Graphik LC' },
android: { fontFamily: 'Graphik LC_bold' },
}),
normal: Platform.select({
ios: { fontWeight: '400', fontFamily: 'Graphik LC' },
android: { fontFamily: 'Graphik LC' },
}),
};
<Text style={styles.text}>Test<Text/>
//...
const styles = StyleSheet.create({
text: {
...fonts.semibold,
fontSize: 14,
},
});
FS:
assets/fonts
├── Graphik LC_bold.otf
├── Graphik LC.otf
└── Graphik LC_semibold.otf
fontFamily: 'Ambit'
? – DAVID _