React-native-vector-icons: Not show icon from custom font IcoMoon.

Created on 21 Sep 2016  路  2Comments  路  Source: oblador/react-native-vector-icons

I added my custom font in project by short code folow

import { createIconSetFromIcoMoon } from 'react-native-vector-icons';
import icoMoonConfig from './fonts/config.json';
const Icon = createIconSet(icoMoonConfig, 'icomoon', './fonts/icomoon.ttf');

And use it.

<TabNavigator.Item
          titleStyle={[styles.titleStyle]}
          selectedTitleStyle={[styles.titleSelected, {marginTop: -3, marginBottom: 7}]}
          selected={selectedTab === 'home'}
          title={selectedTab === 'home' ? 'HOME' : null}
          renderIcon={() => <Icon color={colors.grey2} name='ivan' size={26} />}
          renderSelectedIcon={() => <Icon color={colors.primary} name='ivan' size={26} />}
          onPress={() => this.changeTab('home')}>
          <Home toggleSideMenu={toggleSideMenu} />
</TabNavigator.Item>

But it not show
7b83ff13a7be433fb2628574eebfe73b

Please help me!

Most helpful comment

From troubleshooting in the docs:

The icons show up as a crossed out box on Android

  • Make sure you've copied the font to android/app/src/main/assets/fonts.
  • Delete the android/app/build folder.
  • Recompile the project.

Additionally the path is relative to the fonts folder so, just omit it and you're probably ok.

All 2 comments

From troubleshooting in the docs:

The icons show up as a crossed out box on Android

  • Make sure you've copied the font to android/app/src/main/assets/fonts.
  • Delete the android/app/build folder.
  • Recompile the project.

Additionally the path is relative to the fonts folder so, just omit it and you're probably ok.

It did work for me :+1:
Thank so much :)

Was this page helpful?
0 / 5 - 0 ratings