react-nativereact-native-safe-area-view

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.


Solution

  • 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.