React-native-ui-kitten: Custom fonts not showing in ui kitten components

Created on 24 Jul 2020  路  5Comments  路  Source: akveo/react-native-ui-kitten

馃挰 Question

UI Kitten and Eva version

| Package | Version |
| ----------- | ----------- |
| @eva-design/eva | 2.0.0 |
| @ui-kitten/components | 5.0.0 |

I'm facing an issue where custom fonts only work in Text components. Button components for example, do not render the correct font.

I have mapped the fonts using CustomMapping.json.

Screenshot_20200724-155726

For both Male/Female buttons do not show the correct font, while I've added a Text component in the Continue button where the correct font is being used.

Does anyone know the reason for this? Thanks

Help wanted

Most helpful comment

The custom mapping isn't working for me at all. Followed the docs.
https://akveo.github.io/react-native-ui-kitten/docs/guides/branding#typography

@artyorsh

if custom fonts do not work at all ensure that you add customMappingPath: './path-to/mapping.json', to evaConfig in metro.config.js. Clear the npm cache with npm start -- --reset-cache after these changes. Also ensure that the fonts are named correctly in the mapping file. If on Mac OS: open the font in Font Book app. On iOS, the Family property will be considered. However, on Android, the file name holds the reference to the font - therefore rename your font file name to the 'Family' property.

All 5 comments

The custom mapping isn't working for me at all. Followed the docs.
https://akveo.github.io/react-native-ui-kitten/docs/guides/branding#typography

@artyorsh

Same issues here, has anyone found a workaround?

So for me it turned out to be human error. I named react-native.config.js incorrectly, I had added react-native-config.js and my issue with custom mapping was because I had set the order of some properties incorrectly. I ended up doing a side by side comparison with the mapping.json file from node_modules.

So, with that embarrasment out of the way, it seems to be working as expected for me now 馃檲

The custom mapping isn't working for me at all. Followed the docs.
https://akveo.github.io/react-native-ui-kitten/docs/guides/branding#typography

@artyorsh

if custom fonts do not work at all ensure that you add customMappingPath: './path-to/mapping.json', to evaConfig in metro.config.js. Clear the npm cache with npm start -- --reset-cache after these changes. Also ensure that the fonts are named correctly in the mapping file. If on Mac OS: open the font in Font Book app. On iOS, the Family property will be considered. However, on Android, the file name holds the reference to the font - therefore rename your font file name to the 'Family' property.

The custom mapping isn't working for me at all. Followed the docs.
https://akveo.github.io/react-native-ui-kitten/docs/guides/branding#typography
@artyorsh

if custom fonts do not work at all ensure that you add customMappingPath: './path-to/mapping.json', to evaConfig in metro.config.js. Clear the npm cache with npm start -- --reset-cache after these changes. Also ensure that the fonts are named correctly in the mapping file. If on Mac OS: open the font in Font Book app. On iOS, the Family property will be considered. However, on Android, the file name holds the reference to the font - therefore rename your font file name to the 'Family' property.

Thanks dude. you save my life. Finally, after 2 days I found your solution. The font-weight was my problem on Android with ui-kitten. :)
I edited basic ui-kitten configs inside mapping.json from here https://raw.githubusercontent.com/eva-design/eva/master/packages/eva/mapping.json and then replace all font-weights bold with normal.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeloagnasin picture jeloagnasin  路  3Comments

nonameolsson picture nonameolsson  路  3Comments

eyalyoli picture eyalyoli  路  3Comments

evangunawan picture evangunawan  路  3Comments

RWOverdijk picture RWOverdijk  路  3Comments