如何删除反应抽屉顶部的空间

Pun*_*sal 6 react-native react-navigation-drawer

我正在使用它,并且顶部有空白。任何人都可以向我提供详细信息以从顶部删除此空白。@react-navigation/抽屉在此输入图像描述

Mou*_*hir 11

如果状态栏隐藏,您可以使用它:

<DrawerContentScrollView 
    contentContainerStyle={{ paddingTop: 0 }}>
</DrawerContentScrollView>
Run Code Online (Sandbox Code Playgroud)


vik*_*rma 8

在 DrawerContentScrollView 中,@react-navigation/drawer 代码中添加了默认的 4 填充,因此要删除此值,只需在 contentContainerStyle 中传递 paddingTop 属性即可。

const insets = useSafeArea();

<DrawerContentScrollView
    contentContainerStyle={{
       paddingTop: insets.top,
    }}
   {...props}>
</DrawerContentScrollView>
Run Code Online (Sandbox Code Playgroud)