[TouchableHighlight] Preserve underlay style when restoring inactive props

Summary:
If you give a TouchableHighlight component some styling (e.g. a background color) with the `underlayStyle` prop, the style is wiped away after touching the component. This diff restores the `underlayStyle`.

Closes https://github.com/facebook/react-native/pull/129
Github Author: James Ide <ide@jameside.com>

Test Plan:
 Create a TouchableHighlight that receives `underlayStyle={{style:
'blue'}}`. It initially has a blue background. Touch it and let go. See the blue background now comes back as expected.
This commit is contained in:
James Ide 2015-03-18 12:22:56 -07:00
parent c43d1458c7
commit f002fda275
1 changed files with 4 additions and 1 deletions

View File

@ -159,7 +159,10 @@ var TouchableHighlight = React.createClass({
this._hideTimeout = null;
if (this.refs[UNDERLAY_REF]) {
this.refs[CHILD_REF].setNativeProps(INACTIVE_CHILD_PROPS);
this.refs[UNDERLAY_REF].setNativeProps(INACTIVE_UNDERLAY_PROPS);
this.refs[UNDERLAY_REF].setNativeProps({
...INACTIVE_UNDERLAY_PROPS,
style: this.state.underlayStyle,
});
}
},