Skip to content

Commit

Permalink
re-render the whole navigation bar while calling immediatelyResetRout…
Browse files Browse the repository at this point in the history
…eStack

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
  • Loading branch information
Hedger Wang authored and facebook-github-bot-8 committed Feb 9, 2016
1 parent 05e4236 commit 7b57b5c
Showing 1 changed file with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var View = require('View');

var { Map } = require('immutable');

var guid = require('guid');
var invariant = require('invariant');

var Interpolators = NavigatorBreadcrumbNavigationBarStyles.Interpolators;
Expand Down Expand Up @@ -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() {
Expand All @@ -192,14 +189,30 @@ 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}
</View>
);
},

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);
Expand Down

0 comments on commit 7b57b5c

Please sign in to comment.