User uploaded FontFamily for React-native App

Viewed 120

I am working on a react-native project, in which I have to implement a functionality in which user can set a custom theme for the app, the theme includes Theme color, font color and font family. The problem I'm facing right now is that the requirement for font family is that user can upload a custom font family from the application that will implemented throughout the application. I have searched about it but i haven't been able to find anything about how I can take a font family that user uploads and link it with my assets and then use it in my application.

2 Answers

In React Native, you need to link the fonts to android & ios folder.

Linking fonts will create each font's entry in Info.plist file (ios) & in assets folder of android/src/main.

This is mandatory.

Also, create react-native.config.js file in project root folder and add below text:

module.exports = {
    project: {
        ios: {},
        android: {},
    },
    assets: ['./src/assets/fonts']
    };
Related