Home > Net >  npx react-native-asset isn't giving any output
npx react-native-asset isn't giving any output

Time:12-31

I am trying to add custom fonts to my app. I tried everything on the internet but nothing works. However, I think that the only thing that works on React Native 0.70.5 is linking assets using npx react-native-asset.

I tried making react-native.config.jsfile, then using npx react-native-asset. However, it just doesn't give any output and resets the command prompt. I even tried Cmder and Windows PowerShell. Nothing works they all reset.

my react-native.config.js

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

CodePudding user response:

You have to specify the exect location of the font's TTF or OTF file.

Update react-native.config.js file like this.

module.exports = {
  project: {
    ios: {},
    android: {},
  },
  assets: ['./assets/fonts/'], // stays the same
};

Put the font files in project>>assets>>fonts folder

After that run command npx react-native-asset

Probabily you will get the results.

  • Related