Repository navigation
Commit 2324866
authored
Subtract min from the accessibilityValue percentage on iOS
## Summary:
Fixes #60015.
On iOS the value of a view with `accessibilityValue={{ min, max, now }}` was `now / (max - min)`: `{ min: 10, max: 20, now: 15 }` was read as "150%", and `min == max` gave "+∞".
It is now `(now - min) / (max - min)`. There is no value when the range is empty or `now` is outside it, the same condition as on Android and in the old architecture.
## Changelog:
[IOS] [FIXED] - The `accessibilityValue` percentage takes `min` into account
## Test Plan:
Added tests to `RCTViewComponentViewTests`; they fail without this change and pass with it. Checked on iOS with https://github.com/faciledictu/rn-a11y-value-percentage-repro: V2 is "50%", V3 "0%", and V5, V6 and V7 have no value.
Differential Revision: D132239979
Pull Request resolved: #600161 parent 7a5d4de commit 2324866
2 files changed
Lines changed: 51 additions & 5 deletions
File tree
- packages/react-native/React
- Fabric/Mounting/ComponentViews/View
- Tests/Mounting
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
582 | 587 | | |
583 | 588 | | |
584 | 589 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
327 | 368 | | |
328 | 369 | | |
329 | 370 | | |
| |||
0 commit comments