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

Categories

0 votes
2.5k views
in Technique[技术] by (71.8m points)

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)? 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.7k users

...