feat: Add role prop to Text component
Summary
As pointed out by @necolas on https://github.com/facebook/react-native/issues/34424#issuecomment-1261482517 we forgot we add the role prop mapping to the Text component. This PR adds a new role prop to Text, mapping the web role values to the already existing accessibilityRole prop and moves the roleToAccessibilityRoleMapping to a common file that can be imported by both the Text and View components as requested on https://github.com/facebook/react-native/issues/34424. This PR also updates the RNTester AcessebilityExample to include a test using this new prop.
Changelog
[General] [Added] - Add role prop to Text component
Test Plan
- Open the RNTester app and navigate to the Accessibility Example page
- Test the
roleprop through theText with role = headingsection
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| android | hermes | arm64-v8a | 7,777,909 | +486 |
| android | hermes | armeabi-v7a | 7,178,967 | +537 |
| android | hermes | x86 | 8,090,829 | +399 |
| android | hermes | x86_64 | 8,062,605 | +485 |
| android | jsc | arm64-v8a | 9,636,993 | +112 |
| android | jsc | armeabi-v7a | 8,401,283 | +115 |
| android | jsc | x86 | 9,586,189 | +131 |
| android | jsc | x86_64 | 10,179,350 | +124 |
Base commit: 5d8a712fd55a63b6d8778aad32af1583d5c5201a Branch: main
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| ios | - | universal | n/a | -- |
Base commit: 5d8a712fd55a63b6d8778aad32af1583d5c5201a Branch: main
@jacdebug would you mind rereviwing this PR?
@jacdebug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
This pull request was successfully merged by @gabrieldonadel in 20718e6b8ce4f5c3a8393067d5e8eb0da910751c.
When will my fix make it into a release? | Upcoming Releases