react-native custom fonts code example

Example 1: react native link fonts

// create a folder in your root directory /assets/fonts/ 
// paste the custom fonts you want used in that folder
// create a file in the root called react-native.config.js
// Then add the following:

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

// then run 

react-native link

Example 2: custom font in react native

create folder in your root directory assets/Fonts and add your custom fonts
you want.
create a file in root folder and called react-native.config.js
Add the following code to the file =>

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


or 
module.exports = {
    assets: ['./assets/Fonts'],
  };


Then, run the following command in your terminal:
react-native link 

to use it declare this way in your styles:
fontFamily: 'your-font-name without extension'

If your font is Raleway-Bold.ttf then,
  fontFamily: 'Raleway-Bold'

Example 3: how to link custom fonts in react native

$ react-native link