

Using Header (from native base) within SafeAreaView (from react-navigation) looks fine on iPhone XS Max but adds excess padding/height for iPhone X
"react-native": "0.59.6",
"react": "16.8.6",
"native-base": "2.12.1",
"react-navigation": "3.9.1",
xcode 10.1
I expect the header & safeareaview to look the same on iPhoneX & iPhone XS Max
Header and SafeAreaView look fine on iPhone XS Max but not on iPhone X
import React, { PureComponent } from 'react';
import { Container, Header } from 'native-base';
import { SafeAreaView } from 'react-navigation';
class Screen extends PureComponent {
render() {
<SafeAreaView style={{ flex: 1 }}>
<Container>
<Header searchBar iosBarStyle="light-content" style={{ alignItems: 'center' }} />
</Container>
</SafeAreaView>;
}
}
just iOS
Have you tried without SafeAreaView? I faced this some time ago, and what I did was to use only Header, without the safe area component. Maybe works for you too if the scope is the same.
I tried using Header without SafeAreaView but it didn't give me the style I wanted for iPhone XS Max. So what I ended up doing was adding a condition wrapper based on the deviceType. If it's an iPhoneXS MAX or XR then use SafeAreaView otherwise just render without the wrapper. Works for now but hoping to optimize it later.
Thanks for the tip!
have you got proper solution? I am facing same issue.
I tried using Header without SafeAreaView but it didn't give me the style I wanted for iPhone XS Max. So what I ended up doing was adding a condition wrapper based on the deviceType. If it's an iPhoneXS MAX or XR then use SafeAreaView otherwise just render without the wrapper. Works for now but hoping to optimize it later.
Thanks for the tip!
can you share your logic ?
Im seeing the same issue.
Use forceInset={{ top: 'never' }} to remove the extra padding added to the header while keeping the safeView inset at the bottom.
return (
<SafeAreaView style={{flex: 1}} forceInset={{ top: 'never' }}>
<Navigator/>
</SafeAreaView>
);
Had the same issue, the space between the header and the notch was too big.
What worked for me was changing the default paddingTop on the native base Header component to 0.

Im seeing the same issue.
Most helpful comment
Im seeing the same issue.