skip to Main Content

Here is my code:

<Drawer.Screen
        name="Home"
        component={StackNavigator}
        options={({route}) => {
          const routeName = getFocusedRouteNameFromRoute(route) ?? 'Billing';
          if (sideMenuDisabledScreens.includes(routeName))
            return {swipeEnabled: false};
        }}
      />

I am implementing drawer navigator in my application and I want to add icon for drawer item home. Inside options I have added route to disable drawer for particular screens. After adding the route disable code I am not able to mention icons for drawerIcon. How can I do this?

2

Answers


  1. Add drawerIcon property like the following:

    drawerIcon: ({ tintColor }) => (
      <Image
        source={require('./chats-icon.png')}
        style={[{ tintColor: tintColor }]}
      />
    ),
    
    Login or Signup to reply.
  2. i get your point, you can have both properties just like this

    options={({route}) => {
              const routeName = getFocusedRouteNameFromRoute(route) ?? 'Billing';
              if (sideMenuDisabledScreens.includes(routeName))
                return {swipeEnabled: false};
            },
           {
            drawerIcon: // add your comp here,
            title:" THIS is possible",
           }
        }
    

    Hope ite helps. feel free for doubts

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search