How to deal with safeAreaView + React Navigation?

Isaac picture Isaac · Nov 26, 2018 · Viewed 10.9k times · Source

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?

Answer

Isaac picture Isaac · Nov 26, 2018

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