[ReactNative] Rename NavigationBar props

This commit is contained in:
Eric Vicenti 2015-04-01 07:50:51 -07:00
parent b6503ba431
commit 5a6bf00223
4 changed files with 13 additions and 14 deletions

View File

@ -115,7 +115,7 @@ var BreadcrumbNavSample = React.createClass({
renderScene={this._renderScene}
navigationBar={
<Navigator.BreadcrumbNavigationBar
navigationBarRouteMapper={this._navBarRouteMapper}
routeMapper={this._navBarRouteMapper}
/>
}
/>

View File

@ -121,8 +121,8 @@ var NavigationBarSample = React.createClass({
)}
navigationBar={
<Navigator.NavigationBar
navigationBarRouteMapper={NavigationBarRouteMapper}
navigationBarStyles={styles.navBar}
routeMapper={NavigationBarRouteMapper}
style={styles.navBar}
/>
}
/>

View File

@ -77,7 +77,7 @@ var NavigatorBreadcrumbNavigationBar = React.createClass({
popToRoute: PropTypes.func,
popToTop: PropTypes.func,
}),
navigationBarRouteMapper: PropTypes.shape({
routeMapper: PropTypes.shape({
rightContentForRoute: PropTypes.func,
titleContentForRoute: PropTypes.func,
iconForRoute: PropTypes.func,
@ -87,7 +87,7 @@ var NavigatorBreadcrumbNavigationBar = React.createClass({
idStack: React.PropTypes.arrayOf(React.PropTypes.number),
presentedIndex: React.PropTypes.number,
}),
navigationBarStyles: View.propTypes.style,
style: View.propTypes.style,
},
statics: {
@ -144,7 +144,7 @@ var NavigatorBreadcrumbNavigationBar = React.createClass({
var titles = navState.routeStack.map(this._renderOrReturnTitle);
var buttons = navState.routeStack.map(this._renderOrReturnRightButton);
return (
<View style={[styles.breadCrumbContainer, this.props.navigationBarStyles]}>
<View style={[styles.breadCrumbContainer, this.props.style]}>
{titles}
{icons}
{buttons}
@ -154,7 +154,7 @@ var NavigatorBreadcrumbNavigationBar = React.createClass({
_renderOrReturnBreadcrumb: function(route, index) {
var uid = this.props.navState.idStack[index];
var navBarRouteMapper = this.props.navigationBarRouteMapper;
var navBarRouteMapper = this.props.routeMapper;
var navOps = this.props.navigator;
var alreadyRendered = this.refs['crumbContainer' + uid];
if (alreadyRendered) {
@ -199,7 +199,7 @@ var NavigatorBreadcrumbNavigationBar = React.createClass({
/>
);
}
var navBarRouteMapper = this.props.navigationBarRouteMapper;
var navBarRouteMapper = this.props.routeMapper;
var titleContent = navBarRouteMapper.titleContentForRoute(
navState.routeStack[index],
this.props.navigator
@ -219,7 +219,7 @@ var NavigatorBreadcrumbNavigationBar = React.createClass({
_renderOrReturnRightButton: function(route, index) {
var navState = this.props.navState;
var navBarRouteMapper = this.props.navigationBarRouteMapper;
var navBarRouteMapper = this.props.routeMapper;
var uid = navState.idStack[index];
var alreadyRendered = this.refs['rightContainer' + uid];
if (alreadyRendered) {

View File

@ -46,7 +46,7 @@ var NavigatorNavigationBar = React.createClass({
propTypes: {
navigator: React.PropTypes.object,
navigationBarRouteMapper: React.PropTypes.shape({
routeMapper: React.PropTypes.shape({
Title: React.PropTypes.func.isRequired,
LeftButton: React.PropTypes.func.isRequired,
RightButton: React.PropTypes.func.isRequired,
@ -56,7 +56,7 @@ var NavigatorNavigationBar = React.createClass({
idStack: React.PropTypes.arrayOf(React.PropTypes.number),
presentedIndex: React.PropTypes.number,
}),
navigationBarStyles: View.propTypes.style,
style: View.propTypes.style,
},
statics: {
@ -133,7 +133,7 @@ var NavigatorNavigationBar = React.createClass({
}, this);
return (
<View style={[styles.navBarContainer, this.props.navigationBarStyles]}>
<View style={[styles.navBarContainer, this.props.style]}>
{components}
</View>
);
@ -145,7 +145,6 @@ var NavigatorNavigationBar = React.createClass({
/*number*/index
) /*object*/ {
var navState = this.props.navState;
var navBarRouteMapper = this.props.navigationBarRouteMapper;
var uid = navState.idStack[index];
var containerRef = componentName + 'Container' + uid;
var alreadyRendered = this.refs[containerRef];
@ -160,7 +159,7 @@ var NavigatorNavigationBar = React.createClass({
);
}
var content = navBarRouteMapper[componentName](
var content = this.props.routeMapper[componentName](
navState.routeStack[index],
this.props.navigator,
index,