4

I want to show label on left and drawerIcon on right but unable figure out how. Here is code

<Drawer.Navigator
      drawerContentOptions={{
        contentContainerStyle: {
          backgroundColor: Colors.primary,
          height: "100%"
        },
        labelStyle: { color: "white" }
      }}
    >
      <Drawer.Screen
        name="HomeScreen"
        component={Home}
        options={{ drawerLabel: "Home" }}
      />
      <Drawer.Screen
        name="Channels"
        component={Channels}
        options={{
          drawerIcon: () => (
            <AntDesign
              name="pluscircle"
              size={20}
              color="white"
            />
          )
        }}
      />
    </Drawer.Navigator>

I would like to show "Channels" on left side and plus icon on right side

Farhan Farooq
  • 193
  • 2
  • 13

3 Answers3

4

on your icon, style it with

style={{
  alignSelf: "center",
  position: "absolute",
  right: 5,
}}

so your AntDesign will be like this

<AntDesign
  style={{
    alignSelf: "center",
    position: "absolute",
    right: 5,
  }}
  name="pluscircle"
  size={20}
  color="white"
/>
Devanada
  • 147
  • 9
1

try with headerLeft and headerRight

 headerLeft: () => (
      <Icon
        style={{padding: 10}}
        onPress={() => {
            consol.log("on press}}
        color={'white'}
        name="menu"
        size={30}
      />
Yoel
  • 7,555
  • 6
  • 27
  • 59
0
  <Drawer.Navigator
  drawerPosition="right"
  drawerType="slide"
  initialRouteName="Home"
  drawerContent={() => <SideBar />}>
  <Drawer.Screen name="Home" component={HomeScreen} />
  <Drawer.Screen name="NewIndex" component={NewIndex} />
</Drawer.Navigator>