[android] fix crash if breadcrumb refs don't exist
This commit is contained in:
parent
3bfa90e433
commit
4b28a847e6
|
@ -119,16 +119,16 @@ var NavigatorBreadcrumbNavigationBar = React.createClass({
|
|||
}
|
||||
|
||||
if (interpolate.Crumb(CRUMB_PROPS[index].style, amount)) {
|
||||
this.refs['crumb_' + index].setNativeProps(CRUMB_PROPS[index]);
|
||||
this._setPropsIfExists('crumb_' + index, CRUMB_PROPS[index]);
|
||||
}
|
||||
if (interpolate.Icon(ICON_PROPS[index].style, amount)) {
|
||||
this.refs['icon_' + index].setNativeProps(ICON_PROPS[index]);
|
||||
this._setPropsIfExists('icon_' + index, ICON_PROPS[index]);
|
||||
}
|
||||
if (interpolate.Separator(SEPARATOR_PROPS[index].style, amount)) {
|
||||
this.refs['separator_' + index].setNativeProps(SEPARATOR_PROPS[index]);
|
||||
this._setPropsIfExists('separator_' + index, SEPARATOR_PROPS[index]);
|
||||
}
|
||||
if (interpolate.Title(TITLE_PROPS[index].style, amount)) {
|
||||
this.refs['title_' + index].setNativeProps(TITLE_PROPS[index]);
|
||||
this._setPropsIfExists('title_' + index, TITLE_PROPS[index]);
|
||||
}
|
||||
var right = this.refs['right_' + index];
|
||||
if (right &&
|
||||
|
@ -165,13 +165,10 @@ var NavigatorBreadcrumbNavigationBar = React.createClass({
|
|||
renderToHardwareTextureAndroid: renderToHardwareTexture,
|
||||
};
|
||||
|
||||
this.refs['icon_' + index].setNativeProps(props);
|
||||
this.refs['separator_' + index].setNativeProps(props);
|
||||
this.refs['title_' + index].setNativeProps(props);
|
||||
var right = this.refs['right_' + index];
|
||||
if (right) {
|
||||
right.setNativeProps(props);
|
||||
}
|
||||
this._setPropsIfExists('icon_' + index, props);
|
||||
this._setPropsIfExists('separator_' + index, props);
|
||||
this._setPropsIfExists('title_' + index, props);
|
||||
this._setPropsIfExists('right_' + index, props);
|
||||
},
|
||||
|
||||
componentWillMount: function() {
|
||||
|
@ -260,6 +257,11 @@ var NavigatorBreadcrumbNavigationBar = React.createClass({
|
|||
this._descriptors.right = this._descriptors.right.set(route, rightButtonDescriptor);
|
||||
return rightButtonDescriptor;
|
||||
},
|
||||
|
||||
_setPropsIfExists: function(ref, props) {
|
||||
var ref = this.refs[ref];
|
||||
ref && ref.setNativeProps(props);
|
||||
},
|
||||
});
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
|
|
Loading…
Reference in New Issue