react-native-windows 0.76.7 → 0.76.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/Libraries/Components/Button.windows.js +9 -0
  2. package/Libraries/Components/Pressable/Pressable.windows.js +9 -0
  3. package/Libraries/Components/TextInput/TextInput.windows.js +11 -1
  4. package/Libraries/Components/Touchable/TouchableBounce.windows.js +229 -0
  5. package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +373 -0
  6. package/Libraries/Components/Touchable/TouchableOpacity.windows.js +7 -0
  7. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +8 -0
  8. package/Libraries/Components/View/View.windows.js +11 -1
  9. package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
  10. package/Libraries/Components/View/ViewAccessibility.windows.js +3 -0
  11. package/Libraries/Components/View/ViewPropTypes.windows.js +3 -0
  12. package/Libraries/Core/ReactNativeVersion.js +1 -1
  13. package/Libraries/Image/Image.windows.js +7 -0
  14. package/Libraries/Modal/Modal.windows.js +4 -1
  15. package/Libraries/Text/Text.windows.js +14 -1
  16. package/Libraries/Text/TextProps.windows.js +3 -0
  17. package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
  18. package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.cpp +97 -0
  19. package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.h +53 -0
  20. package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.h +160 -17
  21. package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +8 -10
  22. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +4 -2
  23. package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
  24. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +428 -39
  25. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +39 -1
  26. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +55 -33
  27. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +5 -3
  28. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +43 -5
  29. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
  30. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.cpp +115 -0
  31. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.h +41 -0
  32. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp +298 -0
  33. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.h +59 -0
  34. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +106 -56
  35. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +2 -0
  36. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +163 -10
  37. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +17 -1
  38. package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +4 -2
  39. package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +9 -1
  40. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +348 -316
  41. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
  42. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +78 -0
  43. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
  44. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +22 -0
  45. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -5
  46. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +99 -37
  47. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
  48. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +81 -22
  49. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +21 -2
  50. package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +6 -1
  51. package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +41 -37
  52. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +76 -33
  53. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +8 -2
  54. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +1 -6
  55. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
  56. package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
  57. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +5 -8
  58. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorParser.h +1 -2
  59. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +1 -1
  60. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +15 -1
  61. package/Microsoft.ReactNative/IReactContext.cpp +2 -2
  62. package/Microsoft.ReactNative/IReactContext.h +1 -1
  63. package/Microsoft.ReactNative/IReactContext.idl +2 -2
  64. package/Microsoft.ReactNative/IReactPackageBuilder.idl +3 -3
  65. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +97 -87
  66. package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +4 -0
  67. package/Microsoft.ReactNative/Modules/AlertModule.cpp +9 -4
  68. package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +1 -1
  69. package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +32 -35
  70. package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +7 -4
  71. package/Microsoft.ReactNative/Modules/AppStateModule.cpp +1 -1
  72. package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +2 -2
  73. package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +2 -2
  74. package/Microsoft.ReactNative/Modules/ClipboardModule.cpp +1 -1
  75. package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
  76. package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +3 -3
  77. package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +1 -1
  78. package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +7 -5
  79. package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -1
  80. package/Microsoft.ReactNative/Modules/Timing.cpp +2 -2
  81. package/Microsoft.ReactNative/ReactHost/IReactInstance.h +5 -0
  82. package/Microsoft.ReactNative/ReactHost/React.h +0 -3
  83. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +36 -12
  84. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
  85. package/Microsoft.ReactNative/ReactNativeHost.cpp +9 -4
  86. package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
  87. package/Microsoft.ReactNative/ReactPackageBuilder.cpp +3 -3
  88. package/Microsoft.ReactNative/ReactPackageBuilder.h +4 -4
  89. package/Microsoft.ReactNative/Utils/Helpers.cpp +0 -2
  90. package/Microsoft.ReactNative/Views/DevMenu.cpp +6 -6
  91. package/Microsoft.ReactNative/Views/DevMenu.h +1 -1
  92. package/Microsoft.ReactNative/XamlUIService.cpp +13 -7
  93. package/Microsoft.ReactNative/XamlUIService.h +4 -1
  94. package/Microsoft.ReactNative/XamlUIService.idl +2 -0
  95. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +6 -2
  96. package/Microsoft.ReactNative.Cxx/NativeModules.h +29 -0
  97. package/Microsoft.ReactNative.Cxx/ReactContext.h +1 -1
  98. package/Microsoft.ReactNative.Cxx/XamlUtils.h +12 -0
  99. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  100. package/PropertySheets/React.Cpp.props +3 -0
  101. package/PropertySheets/WebView2.props +1 -1
  102. package/PropertySheets/WinUI.props +5 -4
  103. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +253 -0
  104. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +799 -0
  105. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +39 -35
  106. package/Shared/InspectorPackagerConnection.cpp +2 -5
  107. package/Shared/InspectorPackagerConnection.h +2 -2
  108. package/Shared/Networking/WinRTWebSocketResource.cpp +369 -7
  109. package/Shared/Networking/WinRTWebSocketResource.h +118 -0
  110. package/Shared/Shared.vcxitems +12 -5
  111. package/Shared/Shared.vcxitems.filters +11 -4
  112. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +91 -97
  113. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
  114. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
  115. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
  116. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
  117. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
  118. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
  119. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
  120. package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
  121. package/codegen/react/components/rnwcore/ModalHostView.g.h +279 -0
  122. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
  123. package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
  124. package/codegen/react/components/rnwcore/Switch.g.h +263 -0
  125. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
  126. package/codegen/rnwcoreJSI-generated.cpp +0 -6
  127. package/codegen/rnwcoreJSI.h +0 -9
  128. package/jest/setup.js +5 -1
  129. package/just-task.js +1 -1
  130. package/package.json +11 -11
  131. package/src/private/featureflags/ReactNativeFeatureFlags.js +1 -6
  132. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +1 -2
  133. package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +0 -191
  134. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
  135. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
  136. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
@@ -0,0 +1,799 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include <folly/dynamic.h>
11
+ #include <glog/logging.h>
12
+ #include <react/debug/react_native_assert.h>
13
+ #include <react/debug/react_native_expect.h>
14
+ #include <react/renderer/components/view/AccessibilityPrimitives.h>
15
+ #include <react/renderer/core/PropsParserContext.h>
16
+ #include <react/renderer/core/propsConversions.h>
17
+
18
+ #include <unordered_map>
19
+
20
+ namespace facebook::react {
21
+
22
+ inline void fromString(const std::string& string, AccessibilityTraits& result) {
23
+ if (string == "none") {
24
+ result = AccessibilityTraits::None;
25
+ return;
26
+ }
27
+ if (string == "button" || string == "togglebutton") {
28
+ result = AccessibilityTraits::Button;
29
+ return;
30
+ }
31
+ if (string == "link") {
32
+ result = AccessibilityTraits::Link;
33
+ return;
34
+ }
35
+ if (string == "image" || string == "img") {
36
+ result = AccessibilityTraits::Image;
37
+ return;
38
+ }
39
+ if (string == "selected") {
40
+ result = AccessibilityTraits::Selected;
41
+ return;
42
+ }
43
+ if (string == "plays") {
44
+ result = AccessibilityTraits::PlaysSound;
45
+ return;
46
+ }
47
+ if (string == "keyboardkey" || string == "key") {
48
+ result = AccessibilityTraits::KeyboardKey;
49
+ return;
50
+ }
51
+ if (string == "text") {
52
+ result = AccessibilityTraits::StaticText;
53
+ return;
54
+ }
55
+ if (string == "disabled") {
56
+ result = AccessibilityTraits::NotEnabled;
57
+ return;
58
+ }
59
+ if (string == "frequentUpdates") {
60
+ result = AccessibilityTraits::UpdatesFrequently;
61
+ return;
62
+ }
63
+ if (string == "search") {
64
+ result = AccessibilityTraits::SearchField;
65
+ return;
66
+ }
67
+ if (string == "startsMedia") {
68
+ result = AccessibilityTraits::StartsMediaSession;
69
+ return;
70
+ }
71
+ if (string == "adjustable") {
72
+ result = AccessibilityTraits::Adjustable;
73
+ return;
74
+ }
75
+ if (string == "allowsDirectInteraction") {
76
+ result = AccessibilityTraits::AllowsDirectInteraction;
77
+ return;
78
+ }
79
+ if (string == "pageTurn") {
80
+ result = AccessibilityTraits::CausesPageTurn;
81
+ return;
82
+ }
83
+ if (string == "header" || string == "heading") {
84
+ result = AccessibilityTraits::Header;
85
+ return;
86
+ }
87
+ if (string == "imagebutton") {
88
+ result = AccessibilityTraits::Image | AccessibilityTraits::Button;
89
+ return;
90
+ }
91
+ if (string == "summary") {
92
+ result = AccessibilityTraits::SummaryElement;
93
+ return;
94
+ }
95
+ if (string == "switch") {
96
+ result = AccessibilityTraits::Switch;
97
+ return;
98
+ }
99
+ if (string == "tabbar") {
100
+ result = AccessibilityTraits::TabBar;
101
+ return;
102
+ }
103
+ if (string == "progressbar") {
104
+ result = AccessibilityTraits::UpdatesFrequently;
105
+ return;
106
+ }
107
+ result = AccessibilityTraits::None;
108
+ }
109
+
110
+ inline void fromRawValue(
111
+ const PropsParserContext& context,
112
+ const RawValue& value,
113
+ AccessibilityTraits& result) {
114
+ if (value.hasType<std::string>()) {
115
+ fromString((std::string)value, result);
116
+ return;
117
+ }
118
+
119
+ result = {};
120
+
121
+ react_native_expect(value.hasType<std::vector<std::string>>());
122
+ if (value.hasType<std::vector<std::string>>()) {
123
+ auto items = (std::vector<std::string>)value;
124
+ for (auto& item : items) {
125
+ AccessibilityTraits itemAccessibilityTraits;
126
+ fromString(item, itemAccessibilityTraits);
127
+ result = result | itemAccessibilityTraits;
128
+ }
129
+ } else {
130
+ LOG(ERROR) << "AccessibilityTraits parsing: unsupported type";
131
+ }
132
+ }
133
+
134
+ inline void fromRawValue(
135
+ const PropsParserContext& context,
136
+ const RawValue& value,
137
+ AccessibilityState& result) {
138
+ auto map = (std::unordered_map<std::string, RawValue>)value;
139
+ auto selected = map.find("selected");
140
+ if (selected != map.end()) {
141
+ fromRawValue(context, selected->second, result.selected);
142
+ }
143
+ auto disabled = map.find("disabled");
144
+ if (disabled != map.end()) {
145
+ fromRawValue(context, disabled->second, result.disabled);
146
+ }
147
+ auto checked = map.find("checked");
148
+ if (checked != map.end()) {
149
+ if (checked->second.hasType<std::string>()) {
150
+ if ((std::string)checked->second == "mixed") {
151
+ result.checked = AccessibilityState::Mixed;
152
+ } else {
153
+ result.checked = AccessibilityState::None;
154
+ }
155
+ } else if (checked->second.hasType<bool>()) {
156
+ if ((bool)checked->second == true) {
157
+ result.checked = AccessibilityState::Checked;
158
+ } else {
159
+ result.checked = AccessibilityState::Unchecked;
160
+ }
161
+ } else {
162
+ result.checked = AccessibilityState::None;
163
+ }
164
+ }
165
+ auto busy = map.find("busy");
166
+ if (busy != map.end()) {
167
+ fromRawValue(context, busy->second, result.busy);
168
+ }
169
+ auto expanded = map.find("expanded");
170
+ if (expanded != map.end()) {
171
+ fromRawValue(context, expanded->second, result.expanded);
172
+ }
173
+ // [Windows] - DO NOT REMOVE - required for Windows ISelectionProvider Implementation
174
+ auto readOnly = map.find("readOnly");
175
+ if (readOnly != map.end()) {
176
+ fromRawValue(context, readOnly->second, result.readOnly);
177
+ }
178
+ auto multiselectable = map.find("multiselectable");
179
+ if (multiselectable != map.end()) {
180
+ fromRawValue(context, multiselectable->second, result.multiselectable);
181
+ }
182
+ auto required = map.find("required");
183
+ if (required != map.end()) {
184
+ fromRawValue(context, required->second, result.required);
185
+ }
186
+ // [Windows] - DO NOT REMOVE
187
+ }
188
+
189
+ inline std::string toString(
190
+ const ImportantForAccessibility& importantForAccessibility) {
191
+ switch (importantForAccessibility) {
192
+ case ImportantForAccessibility::Auto:
193
+ return "auto";
194
+ case ImportantForAccessibility::Yes:
195
+ return "yes";
196
+ case ImportantForAccessibility::No:
197
+ return "no";
198
+ case ImportantForAccessibility::NoHideDescendants:
199
+ return "no-hide-descendants";
200
+ }
201
+ }
202
+
203
+ inline void fromRawValue(
204
+ const PropsParserContext& context,
205
+ const RawValue& value,
206
+ ImportantForAccessibility& result) {
207
+ result = ImportantForAccessibility::Auto;
208
+ react_native_expect(value.hasType<std::string>());
209
+ if (value.hasType<std::string>()) {
210
+ auto string = (std::string)value;
211
+ if (string == "auto") {
212
+ result = ImportantForAccessibility::Auto;
213
+ } else if (string == "yes") {
214
+ result = ImportantForAccessibility::Yes;
215
+ } else if (string == "no") {
216
+ result = ImportantForAccessibility::No;
217
+ } else if (string == "no-hide-descendants") {
218
+ result = ImportantForAccessibility::NoHideDescendants;
219
+ } else {
220
+ LOG(ERROR) << "Unsupported ImportantForAccessibility value: " << string;
221
+ react_native_expect(false);
222
+ }
223
+ } else {
224
+ LOG(ERROR) << "Unsupported ImportantForAccessibility type";
225
+ }
226
+ }
227
+
228
+ inline void fromRawValue(
229
+ const PropsParserContext& context,
230
+ const RawValue& value,
231
+ AccessibilityAction& result) {
232
+ auto map = (std::unordered_map<std::string, RawValue>)value;
233
+
234
+ auto name = map.find("name");
235
+ react_native_assert(name != map.end() && name->second.hasType<std::string>());
236
+ if (name != map.end()) {
237
+ fromRawValue(context, name->second, result.name);
238
+ }
239
+
240
+ auto label = map.find("label");
241
+ if (label != map.end()) {
242
+ if (label->second.hasType<std::string>()) {
243
+ result.label = (std::string)label->second;
244
+ }
245
+ }
246
+ }
247
+
248
+ inline void fromRawValue(
249
+ const PropsParserContext&,
250
+ const RawValue& value,
251
+ AccessibilityValue& result) {
252
+ auto map = (std::unordered_map<std::string, RawValue>)value;
253
+
254
+ auto min = map.find("min");
255
+ if (min != map.end()) {
256
+ if (min->second.hasType<int>()) {
257
+ result.min = (int)min->second;
258
+ }
259
+ }
260
+
261
+ auto max = map.find("max");
262
+ if (max != map.end()) {
263
+ if (max->second.hasType<int>()) {
264
+ result.max = (int)max->second;
265
+ }
266
+ }
267
+
268
+ auto now = map.find("now");
269
+ if (now != map.end()) {
270
+ if (now->second.hasType<int>()) {
271
+ result.now = (int)now->second;
272
+ }
273
+ }
274
+
275
+ auto text = map.find("text");
276
+ if (text != map.end()) {
277
+ if (text->second.hasType<std::string>()) {
278
+ result.text = (std::string)text->second;
279
+ }
280
+ }
281
+ }
282
+
283
+ inline void fromRawValue(
284
+ const PropsParserContext& context,
285
+ const RawValue& value,
286
+ AccessibilityLabelledBy& result) {
287
+ if (value.hasType<std::string>()) {
288
+ result.value.push_back((std::string)value);
289
+ } else if (value.hasType<std::vector<std::string>>()) {
290
+ result.value = (std::vector<std::string>)value;
291
+ }
292
+ }
293
+
294
+ inline void fromRawValue(
295
+ const PropsParserContext& context,
296
+ const RawValue& value,
297
+ AccessibilityLiveRegion& result) {
298
+ result = AccessibilityLiveRegion::None;
299
+ react_native_expect(value.hasType<std::string>());
300
+ if (value.hasType<std::string>()) {
301
+ auto string = (std::string)value;
302
+ if (string == "none") {
303
+ result = AccessibilityLiveRegion::None;
304
+ } else if (string == "polite") {
305
+ result = AccessibilityLiveRegion::Polite;
306
+ } else if (string == "assertive") {
307
+ result = AccessibilityLiveRegion::Assertive;
308
+ } else {
309
+ LOG(ERROR) << "Unsupported AccessibilityLiveRegion value: " << string;
310
+ react_native_expect(false);
311
+ }
312
+ } else {
313
+ LOG(ERROR) << "Unsupported AccessibilityLiveRegion type";
314
+ }
315
+ }
316
+
317
+ inline std::string toString(const AccessibilityRole& accessibilityRole) {
318
+ switch (accessibilityRole) {
319
+ case AccessibilityRole::None:
320
+ return "none";
321
+ case AccessibilityRole::Button:
322
+ return "button";
323
+ case AccessibilityRole::Dropdownlist:
324
+ return "dropdownlist";
325
+ case AccessibilityRole::Togglebutton:
326
+ return "togglebutton";
327
+ case AccessibilityRole::Link:
328
+ return "link";
329
+ case AccessibilityRole::Search:
330
+ return "search";
331
+ case AccessibilityRole::Image:
332
+ return "image";
333
+ case AccessibilityRole::Keyboardkey:
334
+ return "keyboardkey";
335
+ case AccessibilityRole::Text:
336
+ return "text";
337
+ case AccessibilityRole::Adjustable:
338
+ return "adjustable";
339
+ case AccessibilityRole::Imagebutton:
340
+ return "imagebutton";
341
+ case AccessibilityRole::Header:
342
+ return "header";
343
+ case AccessibilityRole::Summary:
344
+ return "summary";
345
+ case AccessibilityRole::Alert:
346
+ return "alert";
347
+ case AccessibilityRole::Checkbox:
348
+ return "checkbox";
349
+ case AccessibilityRole::Combobox:
350
+ return "combobox";
351
+ case AccessibilityRole::Menu:
352
+ return "menu";
353
+ case AccessibilityRole::Menubar:
354
+ return "menubar";
355
+ case AccessibilityRole::Menuitem:
356
+ return "menuitem";
357
+ case AccessibilityRole::Progressbar:
358
+ return "progressbar";
359
+ case AccessibilityRole::Radio:
360
+ return "radio";
361
+ case AccessibilityRole::Radiogroup:
362
+ return "radiogroup";
363
+ case AccessibilityRole::Scrollbar:
364
+ return "scrollbar";
365
+ case AccessibilityRole::Spinbutton:
366
+ return "spinbutton";
367
+ case AccessibilityRole::Switch:
368
+ return "switch";
369
+ case AccessibilityRole::Tab:
370
+ return "tab";
371
+ case AccessibilityRole::Tabbar:
372
+ return "tabbar";
373
+ case AccessibilityRole::Tablist:
374
+ return "tablist";
375
+ case AccessibilityRole::Timer:
376
+ return "timer";
377
+ case AccessibilityRole::List:
378
+ return "timer";
379
+ case AccessibilityRole::Toolbar:
380
+ return "toolbar";
381
+ case AccessibilityRole::Grid:
382
+ return "grid";
383
+ case AccessibilityRole::Pager:
384
+ return "pager";
385
+ case AccessibilityRole::Scrollview:
386
+ return "scrollview";
387
+ case AccessibilityRole::Horizontalscrollview:
388
+ return "horizontalscrollview";
389
+ case AccessibilityRole::Viewgroup:
390
+ return "viewgroup";
391
+ case AccessibilityRole::Webview:
392
+ return "webview";
393
+ case AccessibilityRole::Drawerlayout:
394
+ return "drawerlayout";
395
+ case AccessibilityRole::Slidingdrawer:
396
+ return "slidingdrawer";
397
+ case AccessibilityRole::Iconmenu:
398
+ return "iconmenu";
399
+ }
400
+
401
+ LOG(ERROR) << "Unsupported AccessibilityRole value";
402
+ react_native_expect(false);
403
+ // sane default for prod
404
+ return "none";
405
+ }
406
+
407
+ inline void fromRawValue(
408
+ const PropsParserContext& context,
409
+ const RawValue& value,
410
+ AccessibilityRole& result) {
411
+ react_native_expect(value.hasType<std::string>());
412
+ if (value.hasType<std::string>()) {
413
+ auto string = (std::string)value;
414
+ if (string == "none") {
415
+ result = AccessibilityRole::None;
416
+ } else if (string == "button") {
417
+ result = AccessibilityRole::Button;
418
+ } else if (string == "dropdownlist") {
419
+ result = AccessibilityRole::Dropdownlist;
420
+ } else if (string == "togglebutton") {
421
+ result = AccessibilityRole::Togglebutton;
422
+ } else if (string == "link") {
423
+ result = AccessibilityRole::Link;
424
+ } else if (string == "search") {
425
+ result = AccessibilityRole::Search;
426
+ } else if (string == "image") {
427
+ result = AccessibilityRole::Image;
428
+ } else if (string == "keyboardkey") {
429
+ result = AccessibilityRole::Keyboardkey;
430
+ } else if (string == "text") {
431
+ result = AccessibilityRole::Text;
432
+ } else if (string == "adjustable") {
433
+ result = AccessibilityRole::Adjustable;
434
+ } else if (string == "imagebutton") {
435
+ result = AccessibilityRole::Imagebutton;
436
+ } else if (string == "header") {
437
+ result = AccessibilityRole::Header;
438
+ } else if (string == "summary") {
439
+ result = AccessibilityRole::Summary;
440
+ } else if (string == "alert") {
441
+ result = AccessibilityRole::Alert;
442
+ } else if (string == "checkbox") {
443
+ result = AccessibilityRole::Checkbox;
444
+ } else if (string == "combobox") {
445
+ result = AccessibilityRole::Combobox;
446
+ } else if (string == "menu") {
447
+ result = AccessibilityRole::Menu;
448
+ } else if (string == "menubar") {
449
+ result = AccessibilityRole::Menubar;
450
+ } else if (string == "menuitem") {
451
+ result = AccessibilityRole::Menuitem;
452
+ } else if (string == "progressbar") {
453
+ result = AccessibilityRole::Progressbar;
454
+ } else if (string == "radio") {
455
+ result = AccessibilityRole::Radio;
456
+ } else if (string == "radiogroup") {
457
+ result = AccessibilityRole::Radiogroup;
458
+ } else if (string == "scrollbar") {
459
+ result = AccessibilityRole::Scrollbar;
460
+ } else if (string == "spinbutton") {
461
+ result = AccessibilityRole::Spinbutton;
462
+ } else if (string == "switch") {
463
+ result = AccessibilityRole::Switch;
464
+ } else if (string == "tab") {
465
+ result = AccessibilityRole::Tab;
466
+ } else if (string == "tabbar") {
467
+ result = AccessibilityRole::Tabbar;
468
+ } else if (string == "tablist") {
469
+ result = AccessibilityRole::Tablist;
470
+ } else if (string == "timer") {
471
+ result = AccessibilityRole::Timer;
472
+ } else if (string == "toolbar") {
473
+ result = AccessibilityRole::Toolbar;
474
+ } else if (string == "grid") {
475
+ result = AccessibilityRole::Grid;
476
+ } else if (string == "pager") {
477
+ result = AccessibilityRole::Pager;
478
+ } else if (string == "scrollview") {
479
+ result = AccessibilityRole::Scrollview;
480
+ } else if (string == "horizontalscrollview") {
481
+ result = AccessibilityRole::Horizontalscrollview;
482
+ } else if (string == "viewgroup") {
483
+ result = AccessibilityRole::Viewgroup;
484
+ } else if (string == "webview") {
485
+ result = AccessibilityRole::Webview;
486
+ } else if (string == "drawerlayout") {
487
+ result = AccessibilityRole::Drawerlayout;
488
+ } else if (string == "slidingdrawer") {
489
+ result = AccessibilityRole::Slidingdrawer;
490
+ } else if (string == "iconmenu") {
491
+ result = AccessibilityRole::Iconmenu;
492
+ } else {
493
+ LOG(ERROR) << "Unsupported AccessibilityRole value: " << string;
494
+ react_native_expect(false);
495
+ // sane default for prod
496
+ result = AccessibilityRole::None;
497
+ }
498
+ return;
499
+ }
500
+
501
+ LOG(ERROR) << "Unsupported AccessibilityRole type";
502
+ react_native_expect(false);
503
+ // sane default for prod
504
+ result = AccessibilityRole::None;
505
+ }
506
+
507
+ inline std::string toString(const Role& role) {
508
+ switch (role) {
509
+ case Role::Alert:
510
+ return "alert";
511
+ case Role::Alertdialog:
512
+ return "alertdialog";
513
+ case Role::Application:
514
+ return "application";
515
+ case Role::Article:
516
+ return "article";
517
+ case Role::Banner:
518
+ return "banner";
519
+ case Role::Button:
520
+ return "button";
521
+ case Role::Cell:
522
+ return "cell";
523
+ case Role::Checkbox:
524
+ return "checkbox";
525
+ case Role::Columnheader:
526
+ return "columnheader";
527
+ case Role::Combobox:
528
+ return "combobox";
529
+ case Role::Complementary:
530
+ return "complementary";
531
+ case Role::Contentinfo:
532
+ return "contentinfo";
533
+ case Role::Definition:
534
+ return "definition";
535
+ case Role::Dialog:
536
+ return "dialog";
537
+ case Role::Directory:
538
+ return "directory";
539
+ case Role::Document:
540
+ return "document";
541
+ case Role::Feed:
542
+ return "feed";
543
+ case Role::Figure:
544
+ return "figure";
545
+ case Role::Form:
546
+ return "form";
547
+ case Role::Grid:
548
+ return "grid";
549
+ case Role::Group:
550
+ return "group";
551
+ case Role::Heading:
552
+ return "heading";
553
+ case Role::Img:
554
+ return "img";
555
+ case Role::Link:
556
+ return "link";
557
+ case Role::List:
558
+ return "list";
559
+ case Role::Listitem:
560
+ return "listitem";
561
+ case Role::Log:
562
+ return "log";
563
+ case Role::Main:
564
+ return "main";
565
+ case Role::Marquee:
566
+ return "marquee";
567
+ case Role::Math:
568
+ return "math";
569
+ case Role::Menu:
570
+ return "menu";
571
+ case Role::Menubar:
572
+ return "menubar";
573
+ case Role::Menuitem:
574
+ return "menuitem";
575
+ case Role::Meter:
576
+ return "meter";
577
+ case Role::Navigation:
578
+ return "navigation";
579
+ case Role::None:
580
+ return "none";
581
+ case Role::Note:
582
+ return "note";
583
+ case Role::Option:
584
+ return "option";
585
+ case Role::Presentation:
586
+ return "presentation";
587
+ case Role::Progressbar:
588
+ return "progressbar";
589
+ case Role::Radio:
590
+ return "radio";
591
+ case Role::Radiogroup:
592
+ return "radiogroup";
593
+ case Role::Region:
594
+ return "region";
595
+ case Role::Row:
596
+ return "row";
597
+ case Role::Rowgroup:
598
+ return "rowgroup";
599
+ case Role::Rowheader:
600
+ return "rowheader";
601
+ case Role::Scrollbar:
602
+ return "scrollbar";
603
+ case Role::Searchbox:
604
+ return "searchbox";
605
+ case Role::Separator:
606
+ return "separator";
607
+ case Role::Slider:
608
+ return "slider";
609
+ case Role::Spinbutton:
610
+ return "spinbutton";
611
+ case Role::Status:
612
+ return "status";
613
+ case Role::Summary:
614
+ return "summary";
615
+ case Role::Switch:
616
+ return "switch";
617
+ case Role::Tab:
618
+ return "tab";
619
+ case Role::Table:
620
+ return "table";
621
+ case Role::Tablist:
622
+ return "tablist";
623
+ case Role::Tabpanel:
624
+ return "tabpanel";
625
+ case Role::Term:
626
+ return "term";
627
+ case Role::Timer:
628
+ return "timer";
629
+ case Role::Toolbar:
630
+ return "toolbar";
631
+ case Role::Tooltip:
632
+ return "tooltip";
633
+ case Role::Tree:
634
+ return "tree";
635
+ case Role::Treegrid:
636
+ return "treegrid";
637
+ case Role::Treeitem:
638
+ return "treeitem";
639
+ }
640
+
641
+ LOG(ERROR) << "Unsupported Role value";
642
+ react_native_expect(false);
643
+ // sane default for prod
644
+ return "none";
645
+ }
646
+
647
+ inline void fromRawValue(
648
+ const PropsParserContext& context,
649
+ const RawValue& value,
650
+ Role& result) {
651
+ react_native_expect(value.hasType<std::string>());
652
+ if (value.hasType<std::string>()) {
653
+ auto string = (std::string)value;
654
+ if (string == "alert") {
655
+ result = Role::Alert;
656
+ } else if (string == "alertdialog") {
657
+ result = Role::Alertdialog;
658
+ } else if (string == "application") {
659
+ result = Role::Application;
660
+ } else if (string == "article") {
661
+ result = Role::Article;
662
+ } else if (string == "banner") {
663
+ result = Role::Banner;
664
+ } else if (string == "button") {
665
+ result = Role::Button;
666
+ } else if (string == "cell") {
667
+ result = Role::Cell;
668
+ } else if (string == "checkbox") {
669
+ result = Role::Checkbox;
670
+ } else if (string == "columnheader") {
671
+ result = Role::Columnheader;
672
+ } else if (string == "combobox") {
673
+ result = Role::Combobox;
674
+ } else if (string == "complementary") {
675
+ result = Role::Complementary;
676
+ } else if (string == "contentinfo") {
677
+ result = Role::Contentinfo;
678
+ } else if (string == "definition") {
679
+ result = Role::Definition;
680
+ } else if (string == "dialog") {
681
+ result = Role::Dialog;
682
+ } else if (string == "directory") {
683
+ result = Role::Directory;
684
+ } else if (string == "document") {
685
+ result = Role::Document;
686
+ } else if (string == "feed") {
687
+ result = Role::Feed;
688
+ } else if (string == "figure") {
689
+ result = Role::Figure;
690
+ } else if (string == "form") {
691
+ result = Role::Form;
692
+ } else if (string == "grid") {
693
+ result = Role::Grid;
694
+ } else if (string == "group") {
695
+ result = Role::Group;
696
+ } else if (string == "heading") {
697
+ result = Role::Heading;
698
+ } else if (string == "img") {
699
+ result = Role::Img;
700
+ } else if (string == "link") {
701
+ result = Role::Link;
702
+ } else if (string == "list") {
703
+ result = Role::List;
704
+ } else if (string == "listitem") {
705
+ result = Role::Listitem;
706
+ } else if (string == "log") {
707
+ result = Role::Log;
708
+ } else if (string == "main") {
709
+ result = Role::Main;
710
+ } else if (string == "marquee") {
711
+ result = Role::Marquee;
712
+ } else if (string == "math") {
713
+ result = Role::Math;
714
+ } else if (string == "menu") {
715
+ result = Role::Menu;
716
+ } else if (string == "menubar") {
717
+ result = Role::Menubar;
718
+ } else if (string == "menuitem") {
719
+ result = Role::Menuitem;
720
+ } else if (string == "meter") {
721
+ result = Role::Meter;
722
+ } else if (string == "navigation") {
723
+ result = Role::Navigation;
724
+ } else if (string == "none") {
725
+ result = Role::None;
726
+ } else if (string == "note") {
727
+ result = Role::Note;
728
+ } else if (string == "option") {
729
+ result = Role::Option;
730
+ } else if (string == "presentation") {
731
+ result = Role::Presentation;
732
+ } else if (string == "progressbar") {
733
+ result = Role::Progressbar;
734
+ } else if (string == "radio") {
735
+ result = Role::Radio;
736
+ } else if (string == "radiogroup") {
737
+ result = Role::Radiogroup;
738
+ } else if (string == "region") {
739
+ result = Role::Region;
740
+ } else if (string == "row") {
741
+ result = Role::Row;
742
+ } else if (string == "rowgroup") {
743
+ result = Role::Rowgroup;
744
+ } else if (string == "rowheader") {
745
+ result = Role::Rowheader;
746
+ } else if (string == "scrollbar") {
747
+ result = Role::Scrollbar;
748
+ } else if (string == "searchbox") {
749
+ result = Role::Searchbox;
750
+ } else if (string == "separator") {
751
+ result = Role::Separator;
752
+ } else if (string == "slider") {
753
+ result = Role::Slider;
754
+ } else if (string == "spinbutton") {
755
+ result = Role::Spinbutton;
756
+ } else if (string == "status") {
757
+ result = Role::Status;
758
+ } else if (string == "summary") {
759
+ result = Role::Summary;
760
+ } else if (string == "switch") {
761
+ result = Role::Switch;
762
+ } else if (string == "tab") {
763
+ result = Role::Tab;
764
+ } else if (string == "table") {
765
+ result = Role::Table;
766
+ } else if (string == "tablist") {
767
+ result = Role::Tablist;
768
+ } else if (string == "tabpanel") {
769
+ result = Role::Tabpanel;
770
+ } else if (string == "term") {
771
+ result = Role::Term;
772
+ } else if (string == "timer") {
773
+ result = Role::Timer;
774
+ } else if (string == "toolbar") {
775
+ result = Role::Toolbar;
776
+ } else if (string == "tooltip") {
777
+ result = Role::Tooltip;
778
+ } else if (string == "tree") {
779
+ result = Role::Tree;
780
+ } else if (string == "treegrid") {
781
+ result = Role::Treegrid;
782
+ } else if (string == "treeitem") {
783
+ result = Role::Treeitem;
784
+ } else {
785
+ LOG(ERROR) << "Unsupported Role value: " << string;
786
+ react_native_expect(false);
787
+ // sane default for prod
788
+ result = Role::None;
789
+ }
790
+ return;
791
+ }
792
+
793
+ LOG(ERROR) << "Unsupported Role type";
794
+ react_native_expect(false);
795
+ // sane default for prod
796
+ result = Role::None;
797
+ }
798
+
799
+ } // namespace facebook::react