Add disabled to accessibilityTraits in case button is disabled
Reviewed By: javache Differential Revision: D4593622 fbshipit-source-id: 211f90f6af531a577af4e5487b43a3870f725bff
This commit is contained in:
parent
fd4ad6ca82
commit
813f873320
|
@ -111,11 +111,15 @@ class Button extends React.Component {
|
||||||
'The title prop of a Button must be a string',
|
'The title prop of a Button must be a string',
|
||||||
);
|
);
|
||||||
const formattedTitle = Platform.OS === 'android' ? title.toUpperCase() : title;
|
const formattedTitle = Platform.OS === 'android' ? title.toUpperCase() : title;
|
||||||
|
const accessibilityTraits = ['button'];
|
||||||
|
if (disabled) {
|
||||||
|
accessibilityTraits.push('disabled');
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<Touchable
|
<Touchable
|
||||||
accessibilityComponentType="button"
|
accessibilityComponentType="button"
|
||||||
accessibilityLabel={accessibilityLabel}
|
accessibilityLabel={accessibilityLabel}
|
||||||
accessibilityTraits={['button']}
|
accessibilityTraits={accessibilityTraits}
|
||||||
testID={testID}
|
testID={testID}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onPress={onPress}>
|
onPress={onPress}>
|
||||||
|
|
Loading…
Reference in New Issue