Repository navigation
Add AccessibilityInfo.isSwitchControlEnabled on iOS - #59180
camilopires wants to merge 1 commit into
Conversation
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>
|
Hi @camilopires! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
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 aswitchControlChangedevent, following the existingisDarkerSystemColorsEnabledpattern. It readsUIAccessibilityIsSwitchControlRunning()and observesUIAccessibilitySwitchControlStatusDidChangeNotification. On Android, the method resolves tofalse.Discussion: react-native-community/discussions-and-proposals#1026
Changelog:
[IOS] [ADDED] -
AccessibilityInfo.isSwitchControlEnabled()andswitchControlChangedTest Plan:
yarn jest packages/react-native/Libraries/Components/AccessibilityInfo: all tests passyarn flow-check: 0 errorsyarn lint: passesyarn build-types --validate: API snapshot up to dateyarn test-generated-typescriptandyarn test-typescript-legacy: passyarn format-check-cpp: passesOn 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.