From 216885406f50ca7d4bcdf3f179cf8f181f9bb505 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Sun, 10 Jul 2016 17:42:23 -0700 Subject: [PATCH] [fix] TouchableHighlight inactive styles --- src/components/Touchable/TouchableHighlight.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/Touchable/TouchableHighlight.js b/src/components/Touchable/TouchableHighlight.js index eda0c047..c1c44a0f 100644 --- a/src/components/Touchable/TouchableHighlight.js +++ b/src/components/Touchable/TouchableHighlight.js @@ -106,11 +106,10 @@ var TouchableHighlight = React.createClass({ backgroundColor: underlayColor, } }, - underlayProps: { - style: { - backgroundColor: style && style.backgroundColor || null - } - } + underlayStyle: [ + INACTIVE_UNDERLAY_PROPS.style, + props.style, + ] }; }, @@ -206,7 +205,10 @@ var TouchableHighlight = React.createClass({ this._hideTimeout = null; if (this._hasPressHandler() && this.refs[UNDERLAY_REF]) { this.refs[CHILD_REF].setNativeProps(INACTIVE_CHILD_PROPS); - this.refs[UNDERLAY_REF].setNativeProps(this.state.underlayProps); + this.refs[UNDERLAY_REF].setNativeProps({ + ...INACTIVE_UNDERLAY_PROPS, + style: this.state.underlayStyle, + }); this.props.onHideUnderlay && this.props.onHideUnderlay(); } }, @@ -264,6 +266,9 @@ var UNDERLAY_REF = keyOf({underlayRef: null}); var INACTIVE_CHILD_PROPS = { style: StyleSheet.create({x: {opacity: 1.0}}).x, }; +var INACTIVE_UNDERLAY_PROPS = { + style: StyleSheet.create({x: {backgroundColor: 'transparent'}}).x, +}; var styles = StyleSheet.create({ root: {