Introduce disabling for Touchable* elements

Summary:Introduce a `disabled` property for Touchable* components.

Fix https://github.com/facebook/react-native/issues/2103
Closes https://github.com/facebook/react-native/pull/5931

Differential Revision: D2969790

Pulled By: mkonicek

fb-gh-sync-id: 570a4ff882219f52f2d2ebef3eb73b1df50a0877
shipit-source-id: 570a4ff882219f52f2d2ebef3eb73b1df50a0877
This commit is contained in:
Kureev Alexey
2016-02-23 19:38:51 -08:00
committed by facebook-github-bot-7
parent 9d1abf0cd5
commit 9951e1ab04
3 changed files with 58 additions and 1 deletions

View File

@@ -337,7 +337,7 @@ var TouchableMixin = {
* Must return true to start the process of `Touchable`.
*/
touchableHandleStartShouldSetResponder: function() {
return true;
return !this.props.disabled;
},
/**

View File

@@ -44,6 +44,10 @@ var TouchableWithoutFeedback = React.createClass({
React.PropTypes.oneOf(View.AccessibilityTraits),
React.PropTypes.arrayOf(React.PropTypes.oneOf(View.AccessibilityTraits)),
]),
/**
* If true, disable all interactions for this component.
*/
disabled: React.PropTypes.bool,
/**
* Called when the touch is released, but not if cancelled (e.g. by a scroll
* that steals the responder lock).