Skip to content
This repository has been archived by the owner on Feb 15, 2019. It is now read-only.

hack to hide navbar #285

Open
wants to merge 7 commits into
base: master
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
11 changes: 8 additions & 3 deletions src/ExNavigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
TouchableOpacity,
View,
ViewPropTypes,
Dimensions,
} from 'react-native';
import PropTypes from 'prop-types';
import PureComponent from './utils/PureComponent';
Expand All @@ -27,9 +28,13 @@ if (expoModule) {
// Exponent draws under the status bar on Android, but vanilla React Native does not.
// So we need to factor the status bar height in with Exponent but can ignore it with
// vanilla React Native
const STATUSBAR_HEIGHT = Platform.OS === 'ios'
? 20
: global.__exponent ? 24 : 0;
const dimentions = Dimensions.get('window');
const iphoneX =
(dimentions.width === 375 || dimentions.width === 812) &&
(dimentions.height === 375 || dimentions.height === 812);
const STATUSBAR_IOS_HEIGHT = iphoneX ? 50 : 20;
const STATUSBAR_HEIGHT =
Platform.OS === 'ios' ? STATUSBAR_IOS_HEIGHT : global.__exponent ? 24 : 0;

const APPBAR_HEIGHT = Platform.OS === 'ios' ? 44 : 55;
const BACKGROUND_COLOR = Platform.OS === 'ios' ? '#EFEFF2' : '#FFF';
Expand Down
12 changes: 10 additions & 2 deletions src/ExNavigationStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import React from 'react';
import { Animated, Platform, StyleSheet, View } from 'react-native';
import { Animated, Platform, StyleSheet, View, Dimensions } from 'react-native';
import PropTypes from 'prop-types';
import NavigationExperimental from './navigation-experimental';

Expand Down Expand Up @@ -46,7 +46,10 @@ const DEFAULT_ROUTE_CONFIG: ExNavigationConfig = {
: NavigationStyles.Fade,
};

const DEFAULT_STATUSBAR_HEIGHT = Platform.OS === 'ios' ? 20 : 25;
const dimentions = Dimensions.get('window')
const iphoneX = (dimentions.width === 375 || dimentions.width === 812) && (dimentions.height === 375 || dimentions.height === 812);
const STATUSBAR_IOS_HEIGHT = (iphoneX) ? 50 : 20;
const DEFAULT_STATUSBAR_HEIGHT = Platform.OS === 'ios' ? STATUSBAR_IOS_HEIGHT : 25;
const STATUSBAR_HEIGHT = Platform.OS === 'ios'
? DEFAULT_STATUSBAR_HEIGHT
: global.__exponent ? DEFAULT_STATUSBAR_HEIGHT : 0;
Expand Down Expand Up @@ -813,6 +816,11 @@ class ExNavigationStack extends PureComponent<any, Props, State> {
customHeight += route.getBarHeight();
hasCustomHeight = true;
}

if (route.params.hideNavigationBar) {
customHeight = 0;
hasCustomHeight = true;
}

if (hasCustomHeight) {
style = ([...style, { marginTop: customHeight }]: Array<
Expand Down
11 changes: 10 additions & 1 deletion src/tab/ExNavigationTabBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
TouchableNativeFeedback,
Text,
View,
Dimensions,
Platform,
} from 'react-native';

import { unsupportedNativeView } from '../ExUnsupportedNativeView';
Expand All @@ -22,7 +24,12 @@ if (expoModule) {

import TabBadge from '../ExNavigationBadge';

const DEFAULT_TAB_BAR_HEIGHT = 56;
const dimentions = Dimensions.get('window');
const iphoneX =
(dimentions.width === 375 || dimentions.width === 812) &&
(dimentions.height === 375 || dimentions.height === 812);

const DEFAULT_TAB_BAR_HEIGHT = Platform.OS === 'ios' && iphoneX ? 80 : 49;

export default class ExNavigationTabBar extends React.Component {
static defaultHeight = DEFAULT_TAB_BAR_HEIGHT;
Expand Down Expand Up @@ -154,6 +161,8 @@ const styles = StyleSheet.create({
itemContainer: {
flex: 1,
flexDirection: 'row',
alignItems: 'flex-start',
paddingTop: 1,
},
tabItem: {
flex: 1,
Expand Down