简体   繁体   English

React Native SafeAreaView 仅水平

[英]React Native SafeAreaView horizontal-only

Is it possible to use the react native SafeAreaView ( react-native-safe-area-context ) only horizontally (or remove the generated top padding)?是否可以仅水平使用反应原生 SafeAreaView ( react-native-safe-area-context )(或删除生成的顶部填充)? When using it eg in a modal that slides from the bottom, the iPhone X spacing is added on the top although it's actually far away from the screen top.例如,在从底部滑动的模式中使用它时,iPhone X 间距会添加到顶部,尽管它实际上离屏幕顶部很远。 It should only add the necessary spacings to the left and right in landscape.它应该只在横向的左右添加必要的间距。

Does using the edges prop work for you?使用edges道具对你有用吗?

<SafeAreaView edges={['left', 'right']} />

You can add bottom to the above array if you want it removed from the top only.如果您只想从顶部删除它,您可以将bottom添加到上面的数组中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM