Icon not displaying on screen android using react-native-vector-icons

YaSh Chaudhary picture YaSh Chaudhary · Apr 29, 2017 · Viewed 9.1k times · Source

I am using create-react-native-app. I want to use react-native-vector-icons

But its not showing anything on android screen (I am viewing it on expo app)

Here is what I did:

App.js:

       const Courses = TabNavigator({
  ReactCourses: { screen: ReactCourses },
  NativeCourses: { screen: NativeCourses },
}, {
  tabBarOptions: {
    activeTintColor: '#e91e63',
    swipeEnabled: true,
    showIcon:true,
  },
});

ReactCourses.js:

     import Icon from 'react-native-vector-icons/MaterialIcons';
    static navigationOptions = {
    tabBarLabel: 'React Courses',
    tabBarIcon:({ tintColor }) => (
        <Icon
          name={'home'}
          size={26}
          style={[styles.icon, {color: tintColor}]} />
      )

  }

Answer

Navin prasad picture Navin prasad · Jan 22, 2018

Add the following things in android/app/build.gradle

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

And then execute the command

react-native run-android