Skip to content

Commit

Permalink
Components:Touchables: Expose Accessibility prop. Fix facebook#6550
Browse files Browse the repository at this point in the history
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 facebook#8243

Differential Revision: D3462949

Pulled By: javache

fbshipit-source-id: 65ce6507a1619218ab5b527c970a74af197ef462
  • Loading branch information
omeid authored and Morgan Pretty committed Aug 24, 2016
1 parent d2e0328 commit fb56336
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion Libraries/Components/Touchable/TouchableBounce.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/Touchable/TouchableHighlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/Touchable/TouchableOpacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit fb56336

Please sign in to comment.