I'm trying to adjust space between icon and text in drawer screen.
Here's an image to explain better.
Here's my code
<Drawer.Navigator screenOptions={(navigation) => ({
drawerItemStyle: {
borderRadius: 0,
width: '100%',
marginLeft: 0
}
})}>
<Drawer.Screen
name="HomeScreen"
component={HomeScreen}
options={{
headerShown: true,
headerTransparent: true,
headerTitle: "",
title: 'Start Delivery',
drawerIcon: (({focused}) => <Icon name="car" size={25} color={focused ? "#288df9" : "#777"} style={{padding:0, margin:0}} />)
}}
/>
</Drawer.Navigator>
Thanks

The default
Draweruses aDrawerItemListwhich is a list of DrawerItems. Looking at the source code, the view that wraps the label implements amarginLeftof32. This is hardcoded and cannot be changed without using dirty tricks.Let us test this using the following example.
The above uses a
Viewas a dummy image with a red background. Here is the result.Adding a
marginRightof-32to our icon removes the "gap" completely.Here is the result.
This is not ideal since we have to do this for each icon, thus we could create a custom component and reuse it.
Then, use it for each screen.
There is a second way. We could create a custom drawer. This would allow us to not use the
DrawerItemcomponent but a custom component with custom stylings.