React Native SafeAreaView horizontal-only

5.1k Views Asked by At

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.

1

There are 1 best solutions below

1
On BEST 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.