Skip to content

Commit 0c8db08

Browse files
yungstersfacebook-github-bot
authored andcommitted
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
1 parent 2ae559a commit 0c8db08

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Libraries/Components/Switch/Switch.js

+1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ class Switch extends React.Component<Props> {
164164
<SwitchNativeComponent
165165
{...props}
166166
{...platformProps}
167+
accessibilityRole={props.accessibilityRole ?? 'button'}
167168
onChange={this._handleChange}
168169
onResponderTerminationRequest={returnsFalse}
169170
onStartShouldSetResponder={returnsTrue}

0 commit comments

Comments
 (0)