Adding fonts to react-native cli project
Let’s try to add custom font to react-native cli project step by step:-
Create new project
Section titled “Create new project”# Create new projectnpx @react-native-community/cli@latest init new-project-name
# Create folder to hold the fonts and copy the fonts files to this foldermakdir ./assets/fontsCreate or update react-native.config.js
Section titled “Create or update react-native.config.js”module.exports = { projects: { ios: {}, android: {}, }, asserts: ['./assets/fonts/'],}Andorid Linking
Section titled “Andorid Linking”# This will add the fonts to android native appnpx react-native-asset
# Check the following folder if the fonts are addedandroid -> app -> src -> main -> assets -> fonts# if it does not work try to remove `link-assets-manifest.json` from android folder and rerun the command
# Restart your application againnpx react-native start --reset-cache
# Try only fontFamily to see if it applies, some times font-weight create issues if you don't have relevant font file.iOS Linking
Section titled “iOS Linking”npx pod-install ios