Skip to content

Add AccessibilityInfo.isSwitchControlEnabled on iOS - #59180

Open
camilopires wants to merge 1 commit into
react:mainfrom
camilopires:a11y/ios-switch-control
Open

camilopires wants to merge 1 commit into
react:mainfrom
camilopires:a11y/ios-switch-control

Conversation

@camilopires

Copy link
Copy Markdown
Contributor

Summary:

Switch Control lets people operate the device with one or more switches, scanning between elements. Apps that use time limits or auto-dismissing UI need to know when it's running, as they already can for screen readers. This was requested before in #31346, which was closed as stale. React Native apps can't currently detect this setting.

This adds AccessibilityInfo.isSwitchControlEnabled() and a switchControlChanged event, following the existing isDarkerSystemColorsEnabled pattern. It reads UIAccessibilityIsSwitchControlRunning() and observes UIAccessibilitySwitchControlStatusDidChangeNotification. On Android, the method resolves to false.

Discussion: react-native-community/discussions-and-proposals#1026

Changelog:

[IOS] [ADDED] - AccessibilityInfo.isSwitchControlEnabled() and switchControlChanged

Test Plan:

  • yarn jest packages/react-native/Libraries/Components/AccessibilityInfo: all tests pass
  • yarn flow-check: 0 errors
  • yarn lint: passes
  • yarn build-types --validate: API snapshot up to date
  • yarn test-generated-typescript and yarn test-typescript-legacy: pass
  • yarn format-check-cpp: passes
  • RNTester builds for the iOS simulator using Xcode 27.1

On an iPhone 18 Pro simulator running iOS 27.0, RNTester's row reads "Switch Control is disabled.", which exercises the getter.

Not verified: turning Switch Control on. The iOS simulator's Settings app has no Switch Control option, so the change event wasn't exercised. It needs a physical device; I'll add the result here once I've run it.

Reads UIAccessibilityIsSwitchControlRunning() and emits switchControlChanged when it changes. Android resolves to false.

Adds Jest tests for the getter and the event wiring, and an RNTester row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@meta-cla

meta-cla Bot commented Oct 18, 2026

Copy link
Copy Markdown

Hi @camilopires!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@github-actions

Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

@meta-cla

meta-cla Bot commented Oct 18, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 18, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant