Switch: Improve Accessibility

Summary: On Android, `Switch` does not currently read its role as a "button". This fixes that and makes it consistent with iOS.

Reviewed By: sahrens

Differential Revision: D13136253

fbshipit-source-id: 0de5d54772d204168138cb2af7815cc458f72682
This commit is contained in:
Tim Yung
2018-12-12 16:55:06 +00:00
committed by Lorenzo Sciandra
parent c43b74193a
commit 83d1e85263
+1
View File
@@ -164,6 +164,7 @@ class Switch extends React.Component<Props> {
<SwitchNativeComponent
{...props}
{...platformProps}
accessibilityRole={props.accessibilityRole ?? 'button'}
onChange={this._handleChange}
onResponderTerminationRequest={returnsFalse}
onStartShouldSetResponder={returnsTrue}