Remove Margin/Spacing from DrawerList/Drawer Items
Current Behavior
- I'm struggling to find in the documentation, a way to make Drawer items full width (or remove the DrawerList margins)

Expected Behavior
I'd like to remove the margin spacing either side of each item in order to consume the width of the drawer.
Your Environment
| software | version |
|---|---|
| iOS or Android | 14 |
| @react-navigation/native | 5.8.1 |
| @react-navigation/drawer | 5.10.1 |
| react-native-reanimated | 1.13.1 |
| react-native-gesture-handler | 1.8.0 |
| react-native-safe-area-context | 3.1.8 |
| react-native-screens | 2.12.0 |
| react-native | 0.63.3 |
| expo | N/A |
| node | 14.15.0 |
| npm or yarn | npm |
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
@react-navigation/native(found:5.8.1, latest:5.8.2)@react-navigation/drawer(found:5.10.1, latest:5.10.2)
Can you verify that the issue still exists after upgrading to the latest versions of these packages?
For those who found this looking for the similar problem, it turns out that despite the inspector indicating this margin comes from the DrawerItemList component, it actually comes from the styling for the DrawerItem itself.
So, when you pass drawerContentOptions to your navigator:
drawerContentOptions={{
activeTintColor: '#cccccc',
itemStyle: {
marginHorizontal: 0,
borderRadius: 0
},
marginHorizontal is the property I needed to add here.
Hi @Eunanibus , I'm trying to do the same thing today but the API has changed and I can't get anything to work. Did you replicate this with react-navigation version 6 ?
Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.
@bobOnGitHub Use marginHorizontal: 0 on drawerItemStyle, that should do it - works for me!
@SKempin, thanks for the reply.
Not the margin I was looking for. Issue #11204 shows the one I wanted: the margin is on a view inside the component drawerItemStyle modifies.
(I have since found a way of getting what I wanted but it uses react-native-paper's drawer.item which then requires reinventing the wheel on some of the inbuilt react-navigation functionality. Leaving #11204 open as it should be possible to remove the margin I'm interested in with react-navigation's api)
In Drawertem in LabelStyle define marginLeft negative like this
<DrawerItem
icon={() => (
<MaterialIcons
name="attach-money"
size={getSize(20)}
color={colors.green200}
/>
)}
onPress={() => null}
labelStyle={styles.itemText}
label={t('drawer.raceHistory')}
/>
itemText: {
fontSize: layout.fontSize.title,
color: colors.green200,
marginLeft:-25
// fontWeight:"bold"
}
@YuriLima23 I figured that out as well, but it isn't a great solution to this issue, the package should just provide us with the ability to target the styling of all the relevant default styles for DrawerItem and not have to override hardcoded values with negative margins on other elements.
Add PaddingStart as 0 in content container style if using custom component.
<DrawerContentScrollView
bounces={false}
contentContainerStyle={{
marginLeft: 0,
paddingStart: 0,
paddingEnd: 0,
backgroundColor: 'blue',
}}
>
Add PaddingStart as 0 in content container style if using custom component.
<DrawerContentScrollView bounces={false} contentContainerStyle={{ marginLeft: 0, paddingStart: 0, paddingEnd: 0, backgroundColor: 'blue', }} >
That's what I was looking for! Thank you
marginLeft: 0, paddingStart: 0, paddingEnd: 0,
This is work for me too 👌