React native 如何移除抽屉顶部的空间
我正在使用它,顶部有空白。能不能给我一些细节来删除顶部的空白。React native 如何移除抽屉顶部的空间,react-native,react-navigation-drawer,React Native,React Navigation Drawer,我正在使用它,顶部有空白。能不能给我一些细节来删除顶部的空白。 @react-navigation/drawer在DrawerContentScrollView中,@react-navigation/drawer代码中添加了默认的填充4,因此要删除contentContainerStyle中的这个只需传递paddingTop属性 const insets = useSafeArea(); <DrawerContentScrollView contentContainerStyle
@react-navigation/drawer在DrawerContentScrollView中,@react-navigation/drawer代码中添加了默认的填充4,因此要删除contentContainerStyle中的这个只需传递paddingTop属性
const insets = useSafeArea();
<DrawerContentScrollView
contentContainerStyle={{
paddingTop: insets.top,
}}
{...props}>
</DrawerContentScrollView>
const insets=useSafeArea();
只是补充一下,我也遇到了同样的问题,useSafeArea已被弃用。
我设法使用UseSafetAreaInsets
import { useSafeAreaInsets } from 'react-native-safe-area-context';
...<DrawerContentScrollView
style={styles.container}
contentContainerStyle={{
paddingTop: insets.top,
}}
>...
从'react native safe-area-context'导入{useSafeaInsets};
......
如果状态栏处于隐藏状态,则可以使用此选项:
<DrawerContentScrollView
contentContainerStyle={{ paddingTop: 0 }}>
</DrawerContentScrollView>
谢谢,我猜有一些填充,但不知道有一个
contentContainerStyle
属性