Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NavigationBar fix for iPhone X, Xs Max, XR #434

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions components/NavigationBar/NavigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ class NavigationBar extends PureComponent {
renderStatusBar() {
const { style } = this.props;

return Device.select({
iPhoneX: (<View style={style.statusBar} />),
default: null,
});
return (<View style={style.statusBar} />);
}

render() {
Expand Down
3 changes: 2 additions & 1 deletion const.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
export const NAVIGATION_HEADER_HEIGHT = 64;
export const NAVIGATION_HEADER_HEIGHT = 44;

export const IPHONE_X_NOTCH_PADDING = 30;
export const IPHONE_X_HOME_INDICATOR_PADDING = 34;
export const IPHONE_X_LONG_SIDE = 812;

export const IPHONE_XR_NOTCH_PADDING = 34;
export const IPHONE_XR_LONG_SIDE = 896;

19 changes: 4 additions & 15 deletions theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ const window = Dimensions.get('window');

const STATUS_BAR_OFFSET = (Platform.OS === 'android' ? -StatusBar.currentConfig : 0);
const NAVIGATION_BAR_HEIGHT = Device.select({
iPhoneX: NAVIGATION_HEADER_HEIGHT + IPHONE_X_NOTCH_PADDING,
iPhoneXR: NAVIGATION_HEADER_HEIGHT + IPHONE_XR_NOTCH_PADDING,
default: NAVIGATION_HEADER_HEIGHT,
iPhoneX: NAVIGATION_HEADER_HEIGHT + IPHONE_X_NOTCH_PADDING + 14,
iPhoneXR: NAVIGATION_HEADER_HEIGHT + IPHONE_XR_NOTCH_PADDING + 14,
default: NAVIGATION_HEADER_HEIGHT + 20,
});

export const sizeVariants = ['', 'left', 'right', 'top', 'bottom', 'horizontal', 'vertical'];
Expand Down Expand Up @@ -1437,17 +1437,6 @@ export default (variables = defaultThemeVariables) => ({
backgroundColor: variables.navBarBackground,
borderBottomColor: variables.navBarBorderColor,
borderBottomWidth: StyleSheet.hairlineWidth,
// Leave space for the status bar on iOS
paddingTop: Device.select({
iPhoneX: 0,
iPhoneXR: 0,
default: (
Platform.OS === 'ios'
&& !Device.isIphoneX
&& !Device.isIphoneXR
? 20 : 0
),
}),
},

componentsContainer: {
Expand Down Expand Up @@ -1592,7 +1581,7 @@ export default (variables = defaultThemeVariables) => ({
}),
flex: 1,
flexGrow: 1,
height: NAVIGATION_HEADER_HEIGHT,
height: NAVIGATION_BAR_HEIGHT,
left: 0,
solidifyAnimation(driver) {
return {
Expand Down