re-render the whole navigation bar while calling immediatelyResetRouteStack

Summary:
public

Navigator expects that the navigation bar implements the method to refresh itself.
NavigatorNavigationBar already has this method but not for NavigatorBreadcrumbNavigationBar.

Fix diff fixes this with the same fix as D2751922 did.

Reviewed By: wenjingw

Differential Revision: D2914475

fb-gh-sync-id: a2960bad5df3b403bdd2ab1dc4d349d7251b86c8
shipit-source-id: a2960bad5df3b403bdd2ab1dc4d349d7251b86c8
This commit is contained in:
Hedger Wang 2016-02-08 19:51:06 -08:00 коммит произвёл facebook-github-bot-8
Родитель 05e4236b80
Коммит 7b57b5c84a
1 изменённых файлов: 19 добавлений и 6 удалений

Просмотреть файл

@ -36,6 +36,7 @@ var View = require('View');
var { Map } = require('immutable');
var guid = require('guid');
var invariant = require('invariant');
var Interpolators = NavigatorBreadcrumbNavigationBarStyles.Interpolators;
@ -179,11 +180,7 @@ var NavigatorBreadcrumbNavigationBar = React.createClass({
},
componentWillMount: function() {
this._descriptors = {
crumb: new Map(),
title: new Map(),
right: new Map(),
};
this._reset();
},
render: function() {
@ -192,7 +189,9 @@ var NavigatorBreadcrumbNavigationBar = React.createClass({
var titles = navState.routeStack.map(this._getTitle);
var buttons = navState.routeStack.map(this._getRightButton);
return (
<View style={[styles.breadCrumbContainer, this.props.style]}>
<View
key={this._key}
style={[styles.breadCrumbContainer, this.props.style]}>
{titles}
{icons}
{buttons}
@ -200,6 +199,20 @@ var NavigatorBreadcrumbNavigationBar = React.createClass({
);
},
immediatelyRefresh: function() {
this._reset();
this.forceUpdate();
},
_reset() {
this._key = guid();
this._descriptors = {
crumb: new Map(),
title: new Map(),
right: new Map(),
};
},
_getBreadcrumb: function(route, index) {
if (this._descriptors.crumb.has(route)) {
return this._descriptors.crumb.get(route);