Skip to content
Merged
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
7 changes: 4 additions & 3 deletions components/NavBarContainer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { StyleSheet, View, PropTypes, Platform, BackAndroid } from 'react-native';

import NavBarContent from './NavBarContent';
import * as Styles from '../styles';

const propTypes = {
backButtonComponent: PropTypes.func,
Expand Down Expand Up @@ -39,14 +40,14 @@ class NavBarContainer extends React.Component {
top: 0,
left: 0,
right: 0,
height: 64,
height: Styles.NAV_BAR_HEIGHT,
},
navbarContainerHidden: {
position: 'absolute',
top: -64,
top: -Styles.NAV_BAR_HEIGHT,
left: 0,
right: 0,
height: 64,
height: Styles.NAV_BAR_HEIGHT,
},
});
}
Expand Down
36 changes: 20 additions & 16 deletions components/NavBarContent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { StyleSheet, Text, View, Animated, Easing, PropTypes } from 'react-native';
import NavButton from './NavButton';
import * as Styles from '../styles';

const propTypes = {
backButtonComponent: PropTypes.func,
Expand Down Expand Up @@ -35,19 +36,20 @@ class NavBarContent extends React.Component {
top: 0,
left: 0,
right: 0,
height: 64, // Default iOS navbar height
height: Styles.NAV_BAR_HEIGHT,
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row',
paddingTop: 13,
paddingTop: Styles.NAV_BAR_PADDING_TOP,
},
navbarText: {
color: 'white',
fontSize: 17,
margin: 10,
marginTop: 14,
marginTop: Styles.NAV_BAR_TEXT_MARGIN_TOP,
marginBottom: Styles.NAV_BAR_TEXT_MARGIN_TOP,
fontWeight: '600',
textAlign: 'center',
textAlign: Styles.NAV_BAR_TEXT_ALIGN,
alignItems: 'center',
},
corner: {
Expand Down Expand Up @@ -141,11 +143,13 @@ class NavBarContent extends React.Component {
);
}

leftCorner = (
<View style={[this.styles.corner, this.styles.alignLeft]}>
{leftCornerContent}
</View>
);
if (this.props.route.leftCorner || this.props.route.index > 0) {
leftCorner = (
<View style={[this.styles.corner, this.styles.alignLeft]}>
{leftCornerContent}
</View>
);
}

/**
* Set rightCorner
Expand All @@ -161,13 +165,13 @@ class NavBarContent extends React.Component {
{...this.props.route.rightCornerProps}
/>
);
}

rightCorner = (
<View style={[this.styles.corner, this.styles.alignRight]}>
{rightCornerContent}
</View>
);
rightCorner = (
<View style={[this.styles.corner, this.styles.alignRight]}>
{rightCornerContent}
</View>
);
}

/**
* Set title message
Expand All @@ -185,7 +189,7 @@ class NavBarContent extends React.Component {
}

titleComponent = (
<View style={{ flex: 3 }}>
<View style={{ flex: 6 }}>
{titleContent}
</View>
);
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import React, {
import { EventEmitter } from 'fbemitter';

import NavBarContainer from './components/NavBarContainer';
import * as Styles from './styles';

const propTypes = {
backButtonComponent: PropTypes.func,
Expand Down Expand Up @@ -156,7 +157,7 @@ class Router extends React.Component {
} else if (this.props.hideNavigationBar || route.hideNavigationBar) {
margin = this.props.noStatusBar ? 0 : 20;
} else {
margin = 64;
margin = Styles.NAV_BAR_HEIGHT;
}

return (
Expand Down
5 changes: 5 additions & 0 deletions styles.android.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const NAV_BAR_HEIGHT = 56;
export const NAV_BAR_TEXT_ALIGN = 'left';
export const NAV_BAR_TEXT_MARGIN_TOP = 0;
export const NAV_BAR_TEXT_MARGIN_BOTTOM = 20;
export const NAV_BAR_PADDING_TOP = 0;
5 changes: 5 additions & 0 deletions styles.ios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const NAV_BAR_HEIGHT = 64;
export const NAV_BAR_TEXT_ALIGN = 'center';
export const NAV_BAR_TEXT_MARGIN_TOP = 14;
export const NAV_BAR_TEXT_MARGIN_BOTTOM = 0;
export const NAV_BAR_PADDING_TOP = 13;