From 0bdb67113984e0ff4aad6bbfee3ad830f702ad8c Mon Sep 17 00:00:00 2001 From: Joel Arvidsson Date: Sat, 5 Mar 2016 10:34:54 -0300 Subject: [PATCH] Evicts removed props from state so that ToolbarAndroid will update. #125 --- lib/create-icon-set.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/create-icon-set.js b/lib/create-icon-set.js index 3b3f6e056..b225f5e52 100644 --- a/lib/create-icon-set.js +++ b/lib/create-icon-set.js @@ -276,7 +276,18 @@ function createIconSet(glyphMap : Object, fontFamily : string, fontFile : string componentWillReceiveProps: function(nextProps) { var keys = Object.keys(IconToolbarAndroid.propTypes); if(!isEqual(pick(nextProps, keys), pick(this.props, keys))) { - this.updateIconSources(nextProps); + var stateToEvict = []; + if (!nextProps.navIconName) { + stateToEvict.push('navIcon'); + } + if (!nextProps.iconName) { + stateToEvict.push('icon'); + } + if (this.state && stateToEvict.length) { + this.replaceState(omit(this.state, stateToEvict), () => this.updateIconSources(nextProps)); + } else { + this.updateIconSources(nextProps); + } } },