question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React native auto-link adding all the fonts

See original GitHub issue

Environment

React Native 0.60 iOS project

Description

Now that we migrated to React Native 0.60 and use the auto-linking, the library automatically adds a bunch of fonts I don’t need in my iOS project as I use my own personal font with my own icons in it.

Is there a way to ignore all of this so it doesn’t get added to my project?

"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Entypo.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Feather.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Fontisto.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Foundation.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Octicons.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Zocial.ttf",


Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:35
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

27reactions
abdelmagied94commented, Jul 15, 2020

I resolved this issue by disabling auto-linking for the package and add the fonts I need to the assets. This is done by modifying react-native.config.js to the following:

const VECTOR_ICONS_FONTS_PATH = "./node_modules/react-native-vector-icons/Fonts"
const VECTOR_FONTS = ["FontAwesome.ttf"]

module.exports = {
  assets: ["./src/res/fonts/"],
  dependencies: {
    // Disable auto linking for `react-native-vector-icons` and link
    // the required fonts manually to avoid duplicate resources issue in iOS.
    "react-native-vector-icons": {
      platforms: {
        ios: null,
        android: null,
      },
      assets: VECTOR_FONTS.map((font) => VECTOR_ICONS_FONTS_PATH + "/" + font),
    },
  },
}

9reactions
radiosilencecommented, Sep 25, 2019

Ok, so we solved this by adding a .yarnclean file in our project route and doing a rimraf and yarn install:

./.yarnclean

AntDesign.ttf
Entypo.ttf
EvilIcons.ttf
Feather.ttf
FontAwesome.ttf
FontAwesome5_Brands.ttf
FontAwesome5_Regular.ttf
FontAwesome5_Solid.ttf
Fontisto.ttf
Foundation.ttf
Ionicons.ttf
MaterialCommunityIcons.ttf
MaterialIcons.ttf
Octicons.ttf
SimpleLineIcons.ttf
Zocial.ttf
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ultimate guide to use custom fonts in react native - Medium
Adding custom fonts in react native project is very simple task with react-native link command but can be tricky if you are a...
Read more >
How to add custom fonts in React Native - LogRocket Blog
All we have to do is to create a fonts directory, add the custom fonts that we want to use, create a config...
Read more >
How add custom fonts in react native version 0.61.5
2 Answers 2 · run npx react-native link · use the font as style={{ fontFamily: "name of font" }} · rerun the app:...
Read more >
Add Custom Fonts in React Native 0.63 for iOS and android
Add fonts to app folder. Create a fonts folder in your src/assets folder on root directory level and paste downloaded fonts files in...
Read more >
Breaking Changes on React native 0.69 - Dev Genius
3. Open the info.plist file. Here we'll add a new array of the type Fonts provided by the application . For each ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found