Components:Touchables: Expose Accessibility prop. Fix #6550

Summary:
With accessibility prop set to true, it is not possible to access
childern elements. This makes it impossible to test Components with
appium and releatives. This commit adds support to change accessiblity
property on Touchable elements to overcome the aforementioned issue.
Closes https://github.com/facebook/react-native/pull/8243

Differential Revision: D3462949

Pulled By: javache

fbshipit-source-id: 65ce6507a1619218ab5b527c970a74af197ef462
This commit is contained in:
Omeid 2016-06-21 08:24:07 -07:00 committed by Facebook Github Bot 8
parent 99bbdff011
commit 4f187074bf
3 changed files with 9 additions and 3 deletions

View File

@ -37,6 +37,12 @@ var TouchableBounce = React.createClass({
mixins: [Touchable.Mixin, NativeMethodsMixin],
propTypes: {
/**
* When true, indicates that the view is an accessibility element. By default,
* all the touchable elements are accessible.
*/
accessible: React.PropTypes.bool,
onPress: React.PropTypes.func,
onPressIn: React.PropTypes.func,
onPressOut: React.PropTypes.func,
@ -129,7 +135,7 @@ var TouchableBounce = React.createClass({
return (
<Animated.View
style={[{transform: [{scale: this.state.scale}]}, this.props.style]}
accessible={true}
accessible={this.props.accessible !== false}
accessibilityLabel={this.props.accessibilityLabel}
accessibilityComponentType={this.props.accessibilityComponentType}
accessibilityTraits={this.props.accessibilityTraits}

View File

@ -227,7 +227,7 @@ var TouchableHighlight = React.createClass({
render: function() {
return (
<View
accessible={true}
accessible={this.props.accessible !== false}
accessibilityLabel={this.props.accessibilityLabel}
accessibilityComponentType={this.props.accessibilityComponentType}
accessibilityTraits={this.props.accessibilityTraits}

View File

@ -160,7 +160,7 @@ var TouchableOpacity = React.createClass({
render: function() {
return (
<Animated.View
accessible={true}
accessible={this.props.accessible !== false}
accessibilityLabel={this.props.accessibilityLabel}
accessibilityComponentType={this.props.accessibilityComponentType}
accessibilityTraits={this.props.accessibilityTraits}