Commit 8b23efd
authored
Adding prop accessibilityUnit to TextAttributesProps (fabric) (#3)
## Summary
Adds the accessibilityUnit to fabric CPP API (part of PR facebook#35130 Adding support for Android Accessibility TtsSpan API)
The TtsSpan API now supports verbatim, date, and fraction but may not work with other span types like phone numbers, currency, time, measure, and money.
An explanation of the use case is as follows:
- Time is spelled 1 0 3 0 instead of ten thirty
- The developer does not have the option to specify if 10m stands for 10 meters or 10 miles, or 10 minutes
- Phone numbers, for example, 33312344, are not yet supported
Implementing the above functionality requires adding a new prop to the react-native API responsible for managing attributes of nested Text.
- Java and CPP TextAttributes manage the functionality.
- Nested Text does not correspond to a Widget on Android but an Android TextView Span.
The spans are updated based on a caching mechanism that re-renders the Android TextView only if specific attributes are updated.
The updates are triggered only if the Text or Paragraph Text attributes change.
- An example of Text attributes is accessibilityRole, font-weight, and backgroundColor.
- An example of Paragraph attributes is textBreakstrategy. They are updated with different mechanisms because they may change the paragraph layout.
These mappings are configured in Java, CPP, and Javascript.
As this and PR [facebook#33468](facebook#33468) require changes to the text attributes, the below work was needed:
- issue documented in PR [facebook#33468 (comment)](facebook#33468 (comment)) and PR [facebook#35130 (comment)](facebook#35130 (comment)). The CPP changes for facebook#35130 are moved to a separate PR ([fabriziobertoglio1987#2](#2)). The RNTester App would crash without a clear stack trace on startup after making changes to CPP. This was later fixed by adding the CPP headers to the prefab library rrc_view (see this [comment](facebook#35130 (comment))).
- Adding the CPP configurations (see [fabriziobertoglio1987#2](https://github.com/fabriziobertoglio1987/react-- native/pull/2)) required extensive troubleshooting and analysis
Related: PR #4 - separating accessibilityUnit from accessibilityMinutes and accessibilityHours1 parent 3e1d292 commit 8b23efd
File tree
19 files changed
+61
-99
lines changed- Libraries/Components/View
- ReactAndroid/src/main/java/com/facebook/react
- uimanager
- views
- text
- view
- ReactCommon/react/renderer
- attributedstring
- components
- text
- view
- packages/rn-tester/js/examples/Accessibility
19 files changed
+61
-99
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | 161 | | |
166 | 162 | | |
167 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
505 | | - | |
| 505 | + | |
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
| |||
Lines changed: 0 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | 321 | | |
328 | 322 | | |
329 | 323 | | |
| |||
Lines changed: 0 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | 45 | | |
49 | 46 | | |
50 | 47 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | 37 | | |
40 | 38 | | |
41 | 39 | | |
| |||
Lines changed: 0 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | 187 | | |
195 | 188 | | |
196 | 189 | | |
| |||
517 | 510 | | |
518 | 511 | | |
519 | 512 | | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | 513 | | |
528 | 514 | | |
529 | 515 | | |
| |||
Lines changed: 0 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | | - | |
19 | 17 | | |
20 | 18 | | |
21 | 19 | | |
22 | | - | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
| |||
51 | 48 | | |
52 | 49 | | |
53 | 50 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 51 | | |
62 | 52 | | |
63 | 53 | | |
| |||
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| 108 | + | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| |||
206 | 208 | | |
207 | 209 | | |
208 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
209 | 214 | | |
210 | 215 | | |
211 | 216 | | |
| |||
607 | 612 | | |
608 | 613 | | |
609 | 614 | | |
610 | | - | |
611 | | - | |
| 615 | + | |
| 616 | + | |
612 | 617 | | |
613 | 618 | | |
614 | 619 | | |
615 | 620 | | |
616 | | - | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
617 | 624 | | |
618 | 625 | | |
619 | 626 | | |
| |||
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
| 147 | + | |
147 | 148 | | |
148 | | - | |
149 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
150 | 162 | | |
151 | 163 | | |
152 | 164 | | |
| |||
Lines changed: 1 addition & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
| |||
108 | 107 | | |
109 | 108 | | |
110 | 109 | | |
111 | | - | |
112 | 110 | | |
113 | 111 | | |
114 | 112 | | |
| |||
132 | 130 | | |
133 | 131 | | |
134 | 132 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | 133 | | |
139 | 134 | | |
140 | 135 | | |
| |||
283 | 278 | | |
284 | 279 | | |
285 | 280 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | 281 | | |
295 | 282 | | |
296 | 283 | | |
| |||
0 commit comments