npx react-native link dose not working for me

Viewed 2865
3 Answers

I think, 'link' has been removed in v0.69. Here are the steps to add custom fonts.

  1. Copy the font files to "./assets/fonts" folder.

  2. Add the react-native.config.js file to project root with the code bellow

    module.exports = {
    assets:['./assets/fonts']}
    
  3. For android no need to link but in the ios additionally follow the below steps.

    Open the ios project in Xcode. Drag and drop font files on to "Copy Bundle Resources". enter image description here

Then open the "Info.plist" and add the fonts. enter image description here

After that goto "Product" menu and hit the "Clean Build Folder". Then start the Metro and start your application.

Use npx react-native-asset for react-native > 0.69

You need to create a react-native.config.js then you can use react-native link command.

Example:

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