Skip to content

Commit

Permalink
[TouchableHighlight] Preserve underlay style when restoring inactive …
Browse files Browse the repository at this point in the history
…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 facebook#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.
  • Loading branch information
ide committed Mar 18, 2015
1 parent c43d145 commit f002fda
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Libraries/Components/Touchable/TouchableHighlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}
},

Expand Down

0 comments on commit f002fda

Please sign in to comment.