
We Specialise in the acquisition of high-performing technology talent across a variety of IT sectors including Digital & Technology Software Development. We are a leading niche digital & tech recruitment specialist for the North East of England. iOS and Android and React Native, Designing for his contribution to the Ronald James Blog this week. Special thanks to our guest blogger Luke Brandon Farrell, a full stack developer. To learn how to link a font to React Native checkout: How to use custom fonts in React Native? Linking your font varies depending on platform and your specific React Native version. Two popular applications for this are FontForge and Birdfont. In that case you can use a font editor to open and export your font file with a different postscript name. In some cases the ‘PostScript name’ contains special characters and you can’t rename the filename to match. fontFamily: Platform.OS = "android" ? "Montserrat" : "Montserrat-bold",īold: Platform.OS = "ios" ? "400" : null Instead of awful conditionals in your application as below… the best approach to fix this discrepancy is to rename your font filename to match the ‘PostScript name’.


Android, requires you to use the fonts filename without the extension. 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.
