You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 62a1fc1
Browse filesBrowse the repository at this point in the historyBrowse files
Add AccessibilityInfo.isShowBordersEnabled and showBordersChanged on iOS (#59177)
Summary:
iOS's Show Borders setting (called Button Shapes before iOS 26.1) outlines tappable controls. UIKit and SwiftUI buttons follow it automatically, but React Native apps can't detect it, so custom `Pressable` buttons can't match. It can also change layout (expo/expo#48058).
This adds `AccessibilityInfo.isShowBordersEnabled()` and a `showBordersChanged` event, following the existing `isDarkerSystemColorsEnabled` pattern.
- iOS 26.1 deprecated `UIAccessibilityButtonShapesEnabled()` in favour of `AXShowBordersEnabled()` in the Accessibility framework.
- The module uses the new API on 26.1 and later, guarded by `__IPHONE_OS_VERSION_MAX_ALLOWED` for older SDKs and by `available` at runtime, and the UIKit API below that.
- React-CoreModules now links the Accessibility framework, in both the podspec and `Package.swift`. The framework exists from iOS 14, below the 15.1 minimum, and the new symbol is weak-linked through `available`.
On Android, the method resolves to `false`.
Discussion: react-native-community/discussions-and-proposals#1026
## Changelog:
[IOS] [ADDED] - `AccessibilityInfo.isShowBordersEnabled()` and `showBordersChanged` (Show Borders, formerly Button Shapes)
Pull Request resolved: #59177
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: `xcodebuild -workspace RNTesterPods.xcworkspace -scheme RNTester -sdk iphonesimulator`, using Xcode 27.1
On an iPhone 18 Pro simulator running iOS 27.0, which uses the `AXShowBordersEnabled` path: I flipped the setting in the simulator's Settings app with a throwaway XCUITest, not part of this PR, and read RNTester's Accessibility → "Check if the display options are enabled" row. RNTester stayed running the whole time, so the row could only update through the change event.
- Before: "Show Borders is disabled."
- Show Borders turned on: "Show Borders is enabled."
- Turned off: "Show Borders is disabled."
Not run: iOS below 26.1, which uses the UIKit fallback. No older simulator runtime was available.
Reviewed By: cipolleschi
Differential Revision: D126037985
Pulled By: javache
fbshipit-source-id: 4fb84b25e5cfbc9c4793d26d9946957d42b38466
0 commit comments