Answers for "react native typescript use custom font"

0

react native typescript use custom font

// Create file 
React-native cli project or with --template typecript

react-native.config.js

======ADD==========
module.exports = {
  assets: ['./src/assets/fonts'],
}

=======run===========
react-native link
after that check your info.plist

must font must be there to use in application 

<key>UIAppFonts</key>
<array>
  <string>Comfortaa-Bold.ttf</string>
  <string>Comfortaa-Light.ttf</string>
  <string>Comfortaa-Medium.ttf</string>
  <string>Comfortaa-Regular.ttf</string>
  <string>Comfortaa-SemiBold.ttf</string>
</array> 


and for andrid like all the files should be like this

Your_app_name /android/app/src/main/assets/fonts
aLL of you fonts file comes here
Posted by: Guest on July-30-2021
1

how to link custom fonts in react native

$ react-native link
Posted by: Guest on January-05-2021
4

react native add custom 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
Posted by: Guest on April-03-2020

Code answers related to "TypeScript"

Browse Popular Code Answers by Language