mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 04:35:36 +08:00
added accessibility props for touchables
Summary: accessibilityLabels are missing in these touchable*.js files. for #5322 ide This is not tested yet. I will update with test. Closes https://github.com/facebook/react-native/pull/5346 Reviewed By: svcscm Differential Revision: D2882061 Pulled By: gkassabli fb-gh-sync-id: dff0ef373e5f5895027cb1cc08c8887a6ace8eee
This commit is contained in:
committed by
facebook-github-bot-5
parent
81fb985335
commit
33d8db599e
@@ -208,7 +208,13 @@ exports.examples = [
|
|||||||
{
|
{
|
||||||
title: 'Auto-focus',
|
title: 'Auto-focus',
|
||||||
render: function() {
|
render: function() {
|
||||||
return <TextInput autoFocus={true} style={styles.singleLine} />;
|
return (
|
||||||
|
<TextInput
|
||||||
|
autoFocus={true}
|
||||||
|
style={styles.singleLine}
|
||||||
|
accessibilityLabel="I am the accessibility label for text input"
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -348,7 +348,13 @@ exports.examples = [
|
|||||||
{
|
{
|
||||||
title: 'Auto-focus',
|
title: 'Auto-focus',
|
||||||
render: function() {
|
render: function() {
|
||||||
return <TextInput autoFocus={true} style={styles.default} />;
|
return (
|
||||||
|
<TextInput
|
||||||
|
autoFocus={true}
|
||||||
|
style={styles.default}
|
||||||
|
accessibilityLabel="I am the accessibility label for text input"
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -144,6 +144,9 @@ var TouchableFeedbackEvents = React.createClass({
|
|||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={styles.wrapper}
|
style={styles.wrapper}
|
||||||
testID="touchable_feedback_events_button"
|
testID="touchable_feedback_events_button"
|
||||||
|
accessibilityLabel="touchable feedback events"
|
||||||
|
accessibilityTraits="button"
|
||||||
|
accessibilityComponentType="button"
|
||||||
onPress={() => this._appendEvent('press')}
|
onPress={() => this._appendEvent('press')}
|
||||||
onPressIn={() => this._appendEvent('pressIn')}
|
onPressIn={() => this._appendEvent('pressIn')}
|
||||||
onPressOut={() => this._appendEvent('pressOut')}
|
onPressOut={() => this._appendEvent('pressOut')}
|
||||||
|
|||||||
@@ -290,10 +290,6 @@ var TextInput = React.createClass({
|
|||||||
* Styles
|
* Styles
|
||||||
*/
|
*/
|
||||||
style: Text.propTypes.style,
|
style: Text.propTypes.style,
|
||||||
/**
|
|
||||||
* Used to locate this view in end-to-end tests
|
|
||||||
*/
|
|
||||||
testID: PropTypes.string,
|
|
||||||
/**
|
/**
|
||||||
* The color of the textInput underline.
|
* The color of the textInput underline.
|
||||||
* @platform android
|
* @platform android
|
||||||
@@ -457,6 +453,9 @@ var TextInput = React.createClass({
|
|||||||
<TouchableWithoutFeedback
|
<TouchableWithoutFeedback
|
||||||
onPress={this._onPress}
|
onPress={this._onPress}
|
||||||
rejectResponderTermination={true}
|
rejectResponderTermination={true}
|
||||||
|
accessible={props.accessible}
|
||||||
|
accessibilityLabel={props.accessibilityLabel}
|
||||||
|
accessibilityTraits={props.accessibilityTraits}
|
||||||
testID={props.testID}>
|
testID={props.testID}>
|
||||||
{textContainer}
|
{textContainer}
|
||||||
</TouchableWithoutFeedback>
|
</TouchableWithoutFeedback>
|
||||||
@@ -520,6 +519,9 @@ var TextInput = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<TouchableWithoutFeedback
|
<TouchableWithoutFeedback
|
||||||
onPress={this._onPress}
|
onPress={this._onPress}
|
||||||
|
accessible={this.props.accessible}
|
||||||
|
accessibilityLabel={this.props.accessibilityLabel}
|
||||||
|
accessibilityComponentType={this.props.accessibilityComponentType}
|
||||||
testID={this.props.testID}>
|
testID={this.props.testID}>
|
||||||
{textContainer}
|
{textContainer}
|
||||||
</TouchableWithoutFeedback>
|
</TouchableWithoutFeedback>
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ var TouchableBounce = React.createClass({
|
|||||||
<Animated.View
|
<Animated.View
|
||||||
style={[{transform: [{scale: this.state.scale}]}, this.props.style]}
|
style={[{transform: [{scale: this.state.scale}]}, this.props.style]}
|
||||||
accessible={true}
|
accessible={true}
|
||||||
|
accessibilityLabel={this.props.accessibilityLabel}
|
||||||
|
accessibilityComponentType={this.props.accessibilityComponentType}
|
||||||
|
accessibilityTraits={this.props.accessibilityTraits}
|
||||||
testID={this.props.testID}
|
testID={this.props.testID}
|
||||||
onStartShouldSetResponder={this.touchableHandleStartShouldSetResponder}
|
onStartShouldSetResponder={this.touchableHandleStartShouldSetResponder}
|
||||||
onResponderTerminationRequest={this.touchableHandleResponderTerminationRequest}
|
onResponderTerminationRequest={this.touchableHandleResponderTerminationRequest}
|
||||||
|
|||||||
@@ -215,6 +215,7 @@ var TouchableHighlight = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
accessible={true}
|
accessible={true}
|
||||||
|
accessibilityLabel={this.props.accessibilityLabel}
|
||||||
accessibilityComponentType={this.props.accessibilityComponentType}
|
accessibilityComponentType={this.props.accessibilityComponentType}
|
||||||
accessibilityTraits={this.props.accessibilityTraits}
|
accessibilityTraits={this.props.accessibilityTraits}
|
||||||
ref={UNDERLAY_REF}
|
ref={UNDERLAY_REF}
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ var TouchableNativeFeedback = React.createClass({
|
|||||||
...onlyChild(this.props.children).props,
|
...onlyChild(this.props.children).props,
|
||||||
nativeBackgroundAndroid: this.props.background,
|
nativeBackgroundAndroid: this.props.background,
|
||||||
accessible: this.props.accessible !== false,
|
accessible: this.props.accessible !== false,
|
||||||
|
accessibilityLabel: this.props.accessibilityLabel,
|
||||||
accessibilityComponentType: this.props.accessibilityComponentType,
|
accessibilityComponentType: this.props.accessibilityComponentType,
|
||||||
accessibilityTraits: this.props.accessibilityTraits,
|
accessibilityTraits: this.props.accessibilityTraits,
|
||||||
testID: this.props.testID,
|
testID: this.props.testID,
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ var TouchableOpacity = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<Animated.View
|
<Animated.View
|
||||||
accessible={true}
|
accessible={true}
|
||||||
|
accessibilityLabel={this.props.accessibilityLabel}
|
||||||
accessibilityComponentType={this.props.accessibilityComponentType}
|
accessibilityComponentType={this.props.accessibilityComponentType}
|
||||||
accessibilityTraits={this.props.accessibilityTraits}
|
accessibilityTraits={this.props.accessibilityTraits}
|
||||||
style={[this.props.style, {opacity: this.state.anim}]}
|
style={[this.props.style, {opacity: this.state.anim}]}
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ var TouchableWithoutFeedback = React.createClass({
|
|||||||
// Note(avik): remove dynamic typecast once Flow has been upgraded
|
// Note(avik): remove dynamic typecast once Flow has been upgraded
|
||||||
return (React: any).cloneElement(onlyChild(this.props.children), {
|
return (React: any).cloneElement(onlyChild(this.props.children), {
|
||||||
accessible: this.props.accessible !== false,
|
accessible: this.props.accessible !== false,
|
||||||
|
accessibilityLabel: this.props.accessibilityLabel,
|
||||||
accessibilityComponentType: this.props.accessibilityComponentType,
|
accessibilityComponentType: this.props.accessibilityComponentType,
|
||||||
accessibilityTraits: this.props.accessibilityTraits,
|
accessibilityTraits: this.props.accessibilityTraits,
|
||||||
testID: this.props.testID,
|
testID: this.props.testID,
|
||||||
|
|||||||
Reference in New Issue
Block a user