React-native-vector-icons: Getting Han Characters instead of actual icons

Created on 6 May 2017  路  5Comments  路  Source: oblador/react-native-vector-icons

Every icon I try to use ends up putting what looks like han characters on the screen instead of the actual icons. I've tried it with FontAwesome and Ionicons.

capture _2017-05-05-17-46-41

Windows 10
react: 15.4.2
react-native: 0.40.0
react-native-vector-icons: 4.1.0
Device: LG V10 (Android 6.0)

I tried manually linking react-native-vector-icons and using react-native link. Both resulted in the same thing.
The font .ttf files are in \android\app\src\main\assets\fonts and are all lowercase.
I tried deleting node modules, npm cache clean, npm i
Between each change I uninstalled and reinstalled the android app with react-native run-android

Here is the important bits of the component that generated that screenshot
````
import Icon from 'react-native-vector-icons/FontAwesome';

{rowData.name}

tel:${rowData.phone})}>



sms:${rowData.phone})}>



mailto:${rowData.email})}>




```

Does anyone have suggestions or ideas as to what is causing this?

Most helpful comment

Its working now. I'm not sure what exactly was the problem but I'll list the things I did for anyone else that finds this.

I was on an older version of gradle so I upgraded to match this projects version of gradle 2.2.3
I manually specified the files to copy over

project.ext.vectoricons = [
    iconFontNames: [ 'FontAwesome.ttf', 'Ionicons.ttf' ] // Name of the font files you want to copy
]

Manually linked everything
deleted node modules, node cache
deleted android build
deleted app from phone
then did npm i, react-native run-android again
and it worked.

All 5 comments

That's quite strange I'd say 馃槃 Does the icon explorer example project work?

@oblador It does I just tested it. Let me compare the example to what I have and see if I can find a difference.

@oblador I have discovered that using <FontAwesome name="rocket" /> just produces the box with an x through it. So I'm guessing I don't have something linked or getting loaded correctly. Really strange that it defaulted to the han characters though.

Its working now. I'm not sure what exactly was the problem but I'll list the things I did for anyone else that finds this.

I was on an older version of gradle so I upgraded to match this projects version of gradle 2.2.3
I manually specified the files to copy over

project.ext.vectoricons = [
    iconFontNames: [ 'FontAwesome.ttf', 'Ionicons.ttf' ] // Name of the font files you want to copy
]

Manually linked everything
deleted node modules, node cache
deleted android build
deleted app from phone
then did npm i, react-native run-android again
and it worked.

Run the below command to link.
npx react-native link react-native-vector-icons

Was this page helpful?
0 / 5 - 0 ratings