Search code examples
react-native

Can't link assets (fonts) in react native >= 0.60


react-native: 0.60.4,
react: 16.8.6,
npm: 6.10.1
XCode: 10.2.1
AndroidStudio: 3.4.1

I created a project using

npx react-native init awesomeApp --template typescript

I have put my assets in the

assets/fonts/<Bunch of .ttf files>

My Directory Structure

awesomeApp
|
+--android
+--ios
+--assets
|  |
|  +---fonts
|      |
|      +-- ProximaNova-Bold.ttf
+--react-native-config.js

then I ran react-native link

Nothing happends, XCode not showing any added Resource neither the android, and when I'm running react-native run-ios showing error that the font is not found.

My react-native-config.js

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

I have also tried yarn react-native link and npx react-native link


Solution

  • Well, finally, I linked my fonts,

    I just renamed my file react-native-config.js to react-native.config.js and it worked.

    I don't know if this is the right way, I just tried and it worked, for me at least.

    Here is the complete walkthrough for linking custom fonts.