iOS requires you use the ‘PostScript Name’ with fontFamily. The discrepancy between font family name on iOS / Android is a well documented difference, but an important one to note. React Native Fonts provides a simple API to unify this difference between iOS and Android, and avoids the needs for ugly workarounds in your code for Android. There is a library which provides a solution to this out on the React Native scene. But in android, sometimes you have to use the exact fontFamily like fontFamily:”Rubik-SemiBold”, fontFamily:’Rubik-Regular’ ” Answer from Stack Overflow. “In IOS, if you use just the fontFamily:’Rubik’, the app automatically identifies the style based on fontStyle like Regualr/Italic/Bold etc. The code above will work on iOS, but your Android application will use the system font, instead of your custom font. ![]() This will break your custom font on Android. iOS is smart, and it will select the correct font based on other properties you provide through the style object e.g. ![]() The first major ‘gotcha’ is to point out the discrepancy between using a custom font in iOS vs. In this article you will learn some of the ‘gotchas’ when using custom fonts in React Native. Although, everything isn’t sunshine and rainbows. You now have custom fonts working in your React Native application… Great.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |