Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 1c4865c

Browse files
committed
hideNavigationBar attribute
Close #19
1 parent a6cef45 commit 1c4865c

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

index.js

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,16 @@ var Router = React.createClass({
9494
};
9595

9696
var Content = route.component;
97+
98+
// Remove the margin of the navigation bar if not using navigation bar
99+
var extraStyling = {};
100+
if (this.props.hideNavigationBar) {
101+
extraStyling.marginTop = 0;
102+
}
97103

98104
return (
99105
<View
100-
style={[styles.container, this.props.bgStyle]}
106+
style={[styles.container, this.props.bgStyle, extraStyling]}
101107
onStartShouldSetResponder={didStartDrag}
102108
onResponderMove={didMoveFinger}
103109
onResponderTerminationRequest={preventDefault}>
@@ -124,21 +130,27 @@ var Router = React.createClass({
124130
StatusBarIOS.setStyle(1);
125131
}
126132

133+
var navigationBar;
134+
135+
if (!this.props.hideNavigationBar) {
136+
navigationBar =
137+
<NavBarContainer
138+
style={this.props.headerStyle}
139+
navigator={navigator}
140+
currentRoute={this.state.routeObj}
141+
backButtonComponent={this.props.backButtonComponent}
142+
rightCorner={this.props.rightCorner}
143+
titleStyle={this.props.titleStyle}
144+
toRoute={this.onForward}
145+
toBack={this.onBack}
146+
customAction={this.customAction}
147+
/>
148+
}
149+
127150
return (
128151
<Navigator
129152
initialRoute={this.props.firstRoute}
130-
navigationBar={
131-
<NavBarContainer
132-
style={this.props.headerStyle}
133-
currentRoute={this.state.route}
134-
backButtonComponent={this.props.backButtonComponent}
135-
rightCorner={this.props.rightCorner}
136-
titleStyle={this.props.titleStyle}
137-
toRoute={this.onForward}
138-
toBack={this.onBack}
139-
customAction={this.customAction}
140-
/>
141-
}
153+
navigationBar={navigationBar}
142154
renderScene={this.renderScene}
143155
onDidFocus={this.onDidFocus}
144156
/>

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-router",
3-
"version": "0.1.3",
3+
"version": "0.2.0",
44
"description": "Awesome navigation for your native app.",
55
"main": "index.js",
66
"scripts": {
@@ -27,7 +27,7 @@
2727
},
2828
"homepage": "https://github.com/t4t5/react-native-router",
2929
"dependencies": {
30-
"react-native": "^0.4.0",
30+
"react-native": "^0.4.x",
3131
"react-tween-state": "0.0.5"
3232
}
3333
}

0 commit comments

Comments
 (0)