mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 20:01:01 +08:00
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:
committed by
facebook-github-bot-7
parent
9d1abf0cd5
commit
9951e1ab04
@@ -337,7 +337,7 @@ var TouchableMixin = {
|
||||
* Must return true to start the process of `Touchable`.
|
||||
*/
|
||||
touchableHandleStartShouldSetResponder: function() {
|
||||
return true;
|
||||
return !this.props.disabled;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user