0

I'm trying to add icons to the below simple React Navigation DrawerNavigator:

  export default createAppContainer(createDrawerNavigator({
  Home: {
    screen: HomeScreen,
    icon: 'home'
  },
  Screen1: {
    screen: Screen1
  },
  Screen2: {
    screen: Screen2
  },
  Screen3: {
    screen: Screen3
  },
}));

The drawer is shown fine but icon isn't.

Alon
  • 75
  • 1
  • 7

2 Answers2

0

The icon needs to be a component like <Image> or <View> , not a string .

RegularGuy
  • 3,516
  • 1
  • 12
  • 29
0

Make sure you have imported react native vector icons to use icons in your Any Component.

 import Ionicons from 'react-native-vector-icons/Ionicons';
    export default createAppContainer(createDrawerNavigator({
    Home: {
    screen: HomeScreen,
    navigationOptions: {
      drawerIcon: () => <Ionicons name="ios-home" size={30} style={{ width: 24 }} 
    color="#000" />
    }
    },
    Screen1: {
    screen: Screen1
    },
    Screen2: {
    screen: Screen2
    },
      Screen3: {
    screen: Screen3
      },
    }));
Wahdat Jan
  • 3,988
  • 3
  • 21
  • 46