[fix] TouchableHighlight inactive styles

This commit is contained in:
Nicolas Gallagher
2016-07-10 17:42:23 -07:00
parent f15bf2664a
commit 216885406f
+11 -6
View File
@@ -106,11 +106,10 @@ var TouchableHighlight = React.createClass({
backgroundColor: underlayColor, backgroundColor: underlayColor,
} }
}, },
underlayProps: { underlayStyle: [
style: { INACTIVE_UNDERLAY_PROPS.style,
backgroundColor: style && style.backgroundColor || null props.style,
} ]
}
}; };
}, },
@@ -206,7 +205,10 @@ var TouchableHighlight = React.createClass({
this._hideTimeout = null; this._hideTimeout = null;
if (this._hasPressHandler() && this.refs[UNDERLAY_REF]) { if (this._hasPressHandler() && this.refs[UNDERLAY_REF]) {
this.refs[CHILD_REF].setNativeProps(INACTIVE_CHILD_PROPS); 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(); this.props.onHideUnderlay && this.props.onHideUnderlay();
} }
}, },
@@ -264,6 +266,9 @@ var UNDERLAY_REF = keyOf({underlayRef: null});
var INACTIVE_CHILD_PROPS = { var INACTIVE_CHILD_PROPS = {
style: StyleSheet.create({x: {opacity: 1.0}}).x, style: StyleSheet.create({x: {opacity: 1.0}}).x,
}; };
var INACTIVE_UNDERLAY_PROPS = {
style: StyleSheet.create({x: {backgroundColor: 'transparent'}}).x,
};
var styles = StyleSheet.create({ var styles = StyleSheet.create({
root: { root: {