Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove space from the top in react-drawer

I am using it and i am getting white space at the top. Can any provide me detail to remove this white space from top. @react-navigation/drawerenter image description here

like image 352
Rover Avatar asked Oct 15 '20 14:10

Rover


2 Answers

In DrawerContentScrollView there is a default padding of 4 was added in @react-navigation/drawer code so to remove this just pass paddingTop prop in contentContainerStyle.

const insets = useSafeArea();

<DrawerContentScrollView
    contentContainerStyle={{
       paddingTop: insets.top,
    }}
   {...props}>
</DrawerContentScrollView>
like image 65
Vikas Sharma Avatar answered Nov 19 '22 22:11

Vikas Sharma


You can use this if the status bar is hidden:

<DrawerContentScrollView 
    contentContainerStyle={{ paddingTop: 0 }}>
</DrawerContentScrollView>
like image 7
Mouad Tahir Avatar answered Nov 19 '22 23:11

Mouad Tahir