react-native-windows 0.0.0-canary.921 → 0.0.0-canary.923

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.
@@ -77,14 +77,12 @@ winrt::Microsoft::ReactNative::Color Color::ReadValue(
77
77
  switch (reader.ValueType()) {
78
78
  case JSValueType::Int64: {
79
79
  auto argb = reader.GetInt64();
80
- return winrt::make<Color>(facebook::react::Color{
81
- /*m_isDefined*/ true,
82
- /*color*/
83
- {static_cast<uint8_t>((argb >> 24) & 0xFF),
84
- static_cast<uint8_t>((argb >> 16) & 0xFF),
85
- static_cast<uint8_t>((argb >> 8) & 0xFF),
86
- static_cast<uint8_t>(argb & 0xFF)},
87
- {}});
80
+ return winrt::make<Color>(facebook::react::Color{/*color*/
81
+ {static_cast<uint8_t>((argb >> 24) & 0xFF),
82
+ static_cast<uint8_t>((argb >> 16) & 0xFF),
83
+ static_cast<uint8_t>((argb >> 8) & 0xFF),
84
+ static_cast<uint8_t>(argb & 0xFF)},
85
+ {}});
88
86
  }
89
87
  case JSValueType::Object: {
90
88
  std::vector<std::string> platformColors;
@@ -96,10 +94,10 @@ winrt::Microsoft::ReactNative::Color Color::ReadValue(
96
94
  SkipValue<JSValue>(reader); // Skip this property
97
95
  }
98
96
  }
99
- return winrt::make<Color>(facebook::react::Color{/*m_isDefined*/ true, /*color*/ {}, std::move(platformColors)});
97
+ return winrt::make<Color>(facebook::react::Color{/*color*/ {}, std::move(platformColors)});
100
98
  }
101
99
  default:
102
- return winrt::make<Color>(facebook::react::Color{/*m_isDefined*/ false, /*color*/ {0, 0, 0, 0}, {}});
100
+ return winrt::make<Color>(facebook::react::Color{/*color*/ {0, 0, 0, 0}, {}});
103
101
  }
104
102
  }
105
103
 
@@ -283,7 +283,7 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPatternProvider(PATTE
283
283
  return S_OK;
284
284
  }
285
285
 
286
- long GetControlType(const std::string &role) noexcept {
286
+ long GetControlTypeFromString(const std::string &role) noexcept {
287
287
  if (role == "adjustable") {
288
288
  return UIA_SliderControlTypeId;
289
289
  } else if (role == "group" || role == "search" || role == "radiogroup" || role == "timer" || role.empty()) {
@@ -346,6 +346,96 @@ long GetControlType(const std::string &role) noexcept {
346
346
  return UIA_GroupControlTypeId;
347
347
  }
348
348
 
349
+ long GetControlTypeFromRole(const facebook::react::Role &role) noexcept {
350
+ switch (role) {
351
+ case facebook::react::Role::Alert:
352
+ return UIA_TextControlTypeId;
353
+ case facebook::react::Role::Application:
354
+ return UIA_WindowControlTypeId;
355
+ case facebook::react::Role::Button:
356
+ return UIA_ButtonControlTypeId;
357
+ case facebook::react::Role::Checkbox:
358
+ return UIA_CheckBoxControlTypeId;
359
+ case facebook::react::Role::Columnheader:
360
+ return UIA_HeaderControlTypeId;
361
+ case facebook::react::Role::Combobox:
362
+ return UIA_ComboBoxControlTypeId;
363
+ case facebook::react::Role::Document:
364
+ return UIA_DocumentControlTypeId;
365
+ case facebook::react::Role::Grid:
366
+ return UIA_GroupControlTypeId;
367
+ case facebook::react::Role::Group:
368
+ return UIA_GroupControlTypeId;
369
+ case facebook::react::Role::Heading:
370
+ return UIA_TextControlTypeId;
371
+ case facebook::react::Role::Img:
372
+ return UIA_ImageControlTypeId;
373
+ case facebook::react::Role::Link:
374
+ return UIA_HyperlinkControlTypeId;
375
+ case facebook::react::Role::List:
376
+ return UIA_ListControlTypeId;
377
+ case facebook::react::Role::Listitem:
378
+ return UIA_ListItemControlTypeId;
379
+ case facebook::react::Role::Menu:
380
+ return UIA_MenuControlTypeId;
381
+ case facebook::react::Role::Menubar:
382
+ return UIA_MenuBarControlTypeId;
383
+ case facebook::react::Role::Menuitem:
384
+ return UIA_MenuItemControlTypeId;
385
+ case facebook::react::Role::None:
386
+ return UIA_GroupControlTypeId;
387
+ case facebook::react::Role::Presentation:
388
+ return UIA_GroupControlTypeId;
389
+ case facebook::react::Role::Progressbar:
390
+ return UIA_ProgressBarControlTypeId;
391
+ case facebook::react::Role::Radio:
392
+ return UIA_RadioButtonControlTypeId;
393
+ case facebook::react::Role::Radiogroup:
394
+ return UIA_GroupControlTypeId;
395
+ case facebook::react::Role::Rowgroup:
396
+ return UIA_GroupControlTypeId;
397
+ case facebook::react::Role::Rowheader:
398
+ return UIA_HeaderControlTypeId;
399
+ case facebook::react::Role::Scrollbar:
400
+ return UIA_ScrollBarControlTypeId;
401
+ case facebook::react::Role::Searchbox:
402
+ return UIA_EditControlTypeId;
403
+ case facebook::react::Role::Separator:
404
+ return UIA_SeparatorControlTypeId;
405
+ case facebook::react::Role::Slider:
406
+ return UIA_SliderControlTypeId;
407
+ case facebook::react::Role::Spinbutton:
408
+ return UIA_SpinnerControlTypeId;
409
+ case facebook::react::Role::Status:
410
+ return UIA_StatusBarControlTypeId;
411
+ case facebook::react::Role::Summary:
412
+ return UIA_GroupControlTypeId;
413
+ case facebook::react::Role::Switch:
414
+ return UIA_ButtonControlTypeId;
415
+ case facebook::react::Role::Tab:
416
+ return UIA_TabItemControlTypeId;
417
+ case facebook::react::Role::Table:
418
+ return UIA_TableControlTypeId;
419
+ case facebook::react::Role::Tablist:
420
+ return UIA_TabControlTypeId;
421
+ case facebook::react::Role::Tabpanel:
422
+ return UIA_TabControlTypeId;
423
+ case facebook::react::Role::Timer:
424
+ return UIA_ButtonControlTypeId;
425
+ case facebook::react::Role::Toolbar:
426
+ return UIA_ToolBarControlTypeId;
427
+ case facebook::react::Role::Tooltip:
428
+ return UIA_ToolTipControlTypeId;
429
+ case facebook::react::Role::Tree:
430
+ return UIA_TreeControlTypeId;
431
+ case facebook::react::Role::Treegrid:
432
+ return UIA_TreeControlTypeId;
433
+ case facebook::react::Role::Treeitem:
434
+ return UIA_TreeItemControlTypeId;
435
+ }
436
+ return UIA_GroupControlTypeId;
437
+ }
438
+
349
439
  HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERTYID propertyId, VARIANT *pRetVal) {
350
440
  if (pRetVal == nullptr)
351
441
  return E_POINTER;
@@ -371,8 +461,10 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERT
371
461
  switch (propertyId) {
372
462
  case UIA_ControlTypePropertyId: {
373
463
  pRetVal->vt = VT_I4;
374
- auto role = props->accessibilityRole.empty() ? compositionView->DefaultControlType() : props->accessibilityRole;
375
- pRetVal->lVal = GetControlType(role);
464
+ pRetVal->lVal = props->role == facebook::react::Role::None ? props->accessibilityRole.empty()
465
+ ? GetControlTypeFromString(compositionView->DefaultControlType())
466
+ : GetControlTypeFromString(props->accessibilityRole)
467
+ : GetControlTypeFromRole(props->role);
376
468
  break;
377
469
  }
378
470
  case UIA_AutomationIdPropertyId: {
@@ -412,12 +504,18 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERT
412
504
  }
413
505
  case UIA_IsContentElementPropertyId: {
414
506
  pRetVal->vt = VT_BOOL;
415
- pRetVal->boolVal = (props->accessible && props->accessibilityRole != "none") ? VARIANT_TRUE : VARIANT_FALSE;
507
+ pRetVal->boolVal =
508
+ (props->accessible && (props->accessibilityRole != "none" || props->role != facebook::react::Role::None))
509
+ ? VARIANT_TRUE
510
+ : VARIANT_FALSE;
416
511
  break;
417
512
  }
418
513
  case UIA_IsControlElementPropertyId: {
419
514
  pRetVal->vt = VT_BOOL;
420
- pRetVal->boolVal = (props->accessible && props->accessibilityRole != "none") ? VARIANT_TRUE : VARIANT_FALSE;
515
+ pRetVal->boolVal =
516
+ (props->accessible && (props->accessibilityRole != "none" || props->role != facebook::react::Role::None))
517
+ ? VARIANT_TRUE
518
+ : VARIANT_FALSE;
421
519
  break;
422
520
  }
423
521
  case UIA_IsOffscreenPropertyId: {
@@ -564,7 +662,6 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::get_IsReadOnly(BOOL *pRe
564
662
  winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->props());
565
663
  if (props == nullptr)
566
664
  return UIA_E_ELEMENTNOTAVAILABLE;
567
- auto accessibilityRole = props->accessibilityRole;
568
665
  if (props->accessibilityState.has_value() && props->accessibilityState->readOnly.has_value()) {
569
666
  *pRetVal = props->accessibilityState->readOnly.value();
570
667
  } else {
@@ -979,10 +979,10 @@ ReactNativeIsland::GetComponentView() noexcept {
979
979
 
980
980
  if (auto fabricuiManager = ::Microsoft::ReactNative::FabricUIManager::FromProperties(
981
981
  winrt::Microsoft::ReactNative::ReactPropertyBag(m_context.Properties()))) {
982
- auto rootComponentViewDescriptor = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(
983
- static_cast<facebook::react::SurfaceId>(m_rootTag));
984
- return rootComponentViewDescriptor.view
985
- .as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>();
982
+ if (auto view = fabricuiManager->GetViewRegistry().findComponentViewWithTag(
983
+ static_cast<facebook::react::SurfaceId>(m_rootTag))) {
984
+ return view.as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>();
985
+ }
986
986
  }
987
987
  return nullptr;
988
988
  }
@@ -12,13 +12,10 @@ namespace facebook::react {
12
12
 
13
13
  struct Color {
14
14
  bool operator==(const Color &otherColor) const {
15
- return m_isUndefined && otherColor.m_isUndefined ||
16
- (m_isUndefined == otherColor.m_isUndefined && m_color == otherColor.m_color &&
17
- m_platformColor == otherColor.m_platformColor);
15
+ return m_color == otherColor.m_color && m_platformColor == otherColor.m_platformColor;
18
16
  }
19
17
  bool operator!=(const Color &otherColor) const {
20
- return m_isUndefined != otherColor.m_isUndefined || m_color != otherColor.m_color ||
21
- m_platformColor != otherColor.m_platformColor;
18
+ return m_color != otherColor.m_color || m_platformColor != otherColor.m_platformColor;
22
19
  }
23
20
 
24
21
  winrt::Windows::UI::Color AsWindowsColor() const {
@@ -36,13 +33,14 @@ struct Color {
36
33
  return RGB(m_color.R, m_color.G, m_color.B) | (m_color.A << 24);
37
34
  }
38
35
 
39
- bool m_isUndefined;
40
36
  winrt::Windows::UI::Color m_color;
41
37
  std::vector<std::string> m_platformColor;
42
38
  };
43
39
 
44
40
  namespace HostPlatformColor {
45
- static const facebook::react::Color UndefinedColor{true};
41
+ static const facebook::react::Color UndefinedColor{
42
+ {0, 0, 0, 0} /*Black*/,
43
+ {"__undefinedColor"} /*Empty PlatformColors*/};
46
44
  } // namespace HostPlatformColor
47
45
 
48
46
  inline Color hostPlatformColorFromComponents(ColorComponents components) {
@@ -53,7 +51,6 @@ inline Color hostPlatformColorFromComponents(ColorComponents components) {
53
51
  static_cast<uint8_t>((int)round(components.green * ratio) & 0xff),
54
52
  static_cast<uint8_t>((int)round(components.blue * ratio) & 0xff)};
55
53
  return {
56
- /* .m_isUndefined = */ false,
57
54
  /* .m_color = */ color,
58
55
  /* .m_platformColor = */ {}};
59
56
  }
@@ -19,7 +19,6 @@ parsePlatformColor(const ContextContainer &contextContainer, int32_t surfaceId,
19
19
  auto map = (std::unordered_map<std::string, std::vector<std::string>>)value;
20
20
  if (map.find("windowsbrush") != map.end()) {
21
21
  facebook::react::Color color = {
22
- /* .m_isDefined = */ true,
23
22
  /* .m_color = */ {},
24
23
  /* .m_platformColor = */ std::move(map["windowsbrush"]),
25
24
  };
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.0.0-canary.921</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.0.0-canary.923</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>0</ReactNativeWindowsMinor>
16
16
  <ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>true</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>ca717fc9756cae188bfb5b8c637c0b7874edb8f3</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>7dea848e43d2606087e5855c0ded29d4c76d93a0</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.0.0-canary.921",
3
+ "version": "0.0.0-canary.923",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",