Don't show underlay if no press handlers
Reviewed By: sahrens Differential Revision: D2915003 fb-gh-sync-id: 56ba942ed464e393ea43229b1fa9ef6936a24ecc shipit-source-id: 56ba942ed464e393ea43229b1fa9ef6936a24ecc
This commit is contained in:
parent
194273f5f5
commit
e93afad284
|
@ -189,7 +189,7 @@ var TouchableHighlight = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
_showUnderlay: function() {
|
_showUnderlay: function() {
|
||||||
if (!this.isMounted()) {
|
if (!this.isMounted() || !this._hasPressHandler()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ var TouchableHighlight = React.createClass({
|
||||||
_hideUnderlay: function() {
|
_hideUnderlay: function() {
|
||||||
this.clearTimeout(this._hideTimeout);
|
this.clearTimeout(this._hideTimeout);
|
||||||
this._hideTimeout = null;
|
this._hideTimeout = null;
|
||||||
if (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.refs[UNDERLAY_REF].setNativeProps({
|
||||||
...INACTIVE_UNDERLAY_PROPS,
|
...INACTIVE_UNDERLAY_PROPS,
|
||||||
|
@ -211,6 +211,15 @@ var TouchableHighlight = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_hasPressHandler: function() {
|
||||||
|
return !!(
|
||||||
|
this.props.onPress ||
|
||||||
|
this.props.onPressIn ||
|
||||||
|
this.props.onPressOut ||
|
||||||
|
this.props.onLongPress
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
|
|
Loading…
Reference in New Issue