Nativebase: Missing Font Awesome 5 files in Fonts folder

Created on 20 Dec 2018  路  11Comments  路  Source: GeekyAnts/NativeBase

Issue Description

It is not possible to use the icons in the "Font Awesome 5" family.
If you try it doing:

<Icon active name="running" type="FontAwesome5"/>

React shows the next error:

Unrecognized font family 'Font Awesome 5 Free'

The issue seems to be due to the fact that the .ttf files for Font Awesome 5 are not included in the /Fonts folder, so they are not linked during react-native link.

I have manually solved the error by copying these files from native-base/node-modules/react-native-vector-icons/Fonts into native-base/Fonts:

  • FontAwesome5_Brands.ttf
  • FontAwesome5_Regular.ttf
  • FontAwesome5_Solid.ttf

And, doing react-native link again.
So I guess they should be added to the /Fonts folder of this repo.

node, npm, react-native, react and native-base version, expo version if used, xcode version

native-base 2.9.2
react-native-vector-icons 6.1.0 (installed automatically by native-base)

Most helpful comment

@rahamin1 If you're using 2.9.x and want to revert to 2.8.2 be sure to make it exactly 2.8.2, not ^2.8.2 in package.json - 2.9.x satisfies semver ^2.8.2 so the package won't be downgraded.

All 11 comments

Have the same problem

Just in case folks are getting a FontAwesome5 error that has Unable to resolve "@expo/vector-icons/FontAwesome5" from "node_modules\native-base\dist\src\basic\IconNB.js", see https://github.com/GeekyAnts/NativeBase/issues/2452#issuecomment-449002348 and read up

Correct me if I'm wrong - RN developers may run react-native link which makes them have FonAwesome5, but expo developers (who cannot run link command) suffer as they are dependent on fonts delivered by expo? Is this the problem here?

Released 2.9.3

(also posted here: https://github.com/expo/vector-icons/issues/58#issuecomment-449291402)

I am using expo version 31.
I was using Native-Base 2.8.0 and some 'ios-xxx-outline' icons didn't display correctly, but there were no problems in the build.
Following suggestions in various posts, I upgraded to 2.9.0 and then to 2.9.3.

This caused mu build to fail with the error:
Unable to resolve "@expo/vector-icons/FontAwesome5" from "node_modules\native-base\dist\src\basic\IconNB.js"

(I am not referring to FontAwesome5 anywhere in my code).

I tried to downgrade to 2.8.0, and ran yarn, I still have the problem. Tried to delete node-modules and rebuild, didn't help. So I am stuck now.
Any idea what to do?

Here is my package.json:

{
  "name": "my-new-project",
  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "node ./node_modules/jest/bin/jest.js --watchAll"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/samples": "2.1.1",
    "axios": "^0.18.0",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "expo": "^31.0.4",
    "firebase": "^5.5.1",
    "js-base64": "^2.4.9",
    "moment": "^2.22.2",
    "native-base": "^2.8.0",
    "react": "16.5.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-31.0.1.tar.gz",
    "react-native-simple-radio-button": "^2.7.3",
    "react-native-snap-carousel": "^3.7.5",
    "react-navigation": "^2.18.2",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-logger": "^3.0.6",
    "redux-persist": "^5.10.0",
    "redux-thunk": "^2.3.0",
    "sentry-expo": "~1.9.0"
  },
  "devDependencies": {
    "babel-eslint": "^9.0.0",
    "eslint": "^5.6.0",
    "eslint-config-jquery": "^1.0.1",
    "eslint-plugin-flowtype": "^2.50.1",
    "eslint-plugin-html": "^4.0.6",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-jquery": "^1.3.2",
    "eslint-plugin-jsx-a11y": "^6.1.1",
    "eslint-plugin-react": "^7.11.1",
    "jest-expo": "^31.0.0"
  }
}


@rahamin1 you can fork and exclude FontAwesome5

Thanks for the prompt reply. Can you elaborate, please?

Two more questions:

  • Any idea why reverting to 2.8.0 or 2.8.2 doesn't help?
  • if I stop using native-base and use expo's instead, do you think it will solve my problem?

@rahamin1 If you're using 2.9.x and want to revert to 2.8.2 be sure to make it exactly 2.8.2, not ^2.8.2 in package.json - 2.9.x satisfies semver ^2.8.2 so the package won't be downgraded.

Solved (kind of) in @expo/vector-icons v8.1.0
See https://github.com/expo/vector-icons/issues/58#issuecomment-450015936

This fixed my issue as well

Screen Shot 2019-06-10 at 8 18 32 PM
Any body have idea about this. I am using native-base version 2.12.1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

muthuraman007 picture muthuraman007  路  3Comments

Bundas picture Bundas  路  3Comments

mcpracht picture mcpracht  路  3Comments

chetnadaffodil picture chetnadaffodil  路  3Comments

eggybot picture eggybot  路  3Comments