Search code examples
react-nativeioniconsreact-native-vector-icons

Ionicon won't show on React Native BottomTabNavigator


I'm trying to set up a simple screen navigation bar using react-navigation. I've got the navigation working but can't make any icons appear on each tab.

I've tried using FontAwesome instead of IonicIcons but the same Box with an X through it appears in place of the desired icon.

import React, {Component} from 'react';
import {createBottomTabNavigator, createAppContainer} from 'react-navigation';
import Icon from 'react-native-vector-icons/Ionicons';

import HomeScreen from './screens/HomeScreen'
import SearchScreen from './screens/SearchScreen'
import ScanScreen from './screens/ScanScreen'

const TabNavigator = createBottomTabNavigator({
  Home: {
    screen: HomeScreen,
    navigationOptions: {
    tabBarIcon: () => (<Icon name="md-home" />)
    }
  },
  Scan: {
    screen: ScanScreen
  },
  Search: {
    screen: SearchScreen
  }
});

export default createAppContainer(TabNavigator);

Solution

  • You have to link it react-native-vector-icons, in your command prompt:

     react-native link react-native-vector-icons