Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is it possible to use the react native SafeAreaView (react-native-safe-area-context) only horizontally (or remove the generated top padding)? When using it e.g. 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. It should only add the necessary spacings to the left and right in landscape.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.5k views
Welcome To Ask or Share your Answers For Others

1 Answer

Does using the edges prop work for you?

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

You can add bottom to the above array if you want it removed from the top only.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...