react-nativereact-navigationiphone-x

How to deal with safeAreaView + React Navigation?


enter image description here

First screenshot was without applying SafeAreaView and second screenshot is applying SafeAreaView

enter image description here

As shown clearly that Stack header seems bulky as compare to previously. Is there anyway where we can apply SafeAreaView to only bottom part?


Solution

  • Instead of using SafeAreaView from React-Native, use SafeAreaView from react-navigation as below:

    import { SafeAreaView } from 'react-navigation';
    

    Then you can use prop forceInset to customize the padding, which in your case,

    <SafeAreaView style={styles.safeArea} forceInset={{ top: 'never' }}>
    

    For more information, check out the iPhone X support by react-navigation