Skip to content
Advertisement

Icons are not appearing in react-native

I am using react-native-vector-icons/FontAwesome to show icons and react-navigation for showing tabs. I am trying to show Home icon in button navigation but icons are not appearing.

PFB relevant code of Icon and createBottomTabNavigator

import React from 'react';
import { createBottomTabNavigator } from 'react-navigation';
// import { Icon } from 'react-native-elements';
import Icon from 'react-native-vector-icons/FontAwesome';

import Account from '../../Form/components/Account';
import Home from '../../Layout/components/Home';

export const Tabs = createBottomTabNavigator({
  Account: { 
    screen: Account,
    navigationOptions: {
      tabBarLabel: 'Account',
      tabBarIcon: ({ tintColor }) => <Icon name="rocket" size={35} color="#fdc94c" />
    }
  },
  Home: { 
    screen: Home,
    navigationOptions: {
      tabBarLabel: 'Home',
      tabBarIcon: ({ tintColor }) => <Icon name="rocket" size={35} color="#fdc94c" />
    },
 }
}, {
  order: ['Home', 'Account'],
  tabBarOptions: {
      showLabel: true,
      showIcon: true,
      activeBackgroundColor: '#42a5f5',
      style: {
        backgroundColor: '#42a5f5',
        paddingVertical: 10,
        height: 60
      },
      indicatorStyle: {
        backgroundColor: '#42a5f5',
      }
    }
})

PFB screenshot as well.

What do I need to do to show icon of Home?enter image description here

Advertisement

Answer

Make sure that the font is linked in your iOS workspace, by using react-native link react-native-vector-icons then rebuild the app

Follow the documentation and make sure that everything is set as they mentioned https://github.com/oblador/react-native-vector-icons#ios

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement