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
@@ -17,7 +17,8 @@ namespace winrt::Microsoft::ReactNative::Composition::implementation {
17
17
  RootComponentView::RootComponentView(
18
18
  const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
19
19
  facebook::react::Tag tag,
20
- winrt::Microsoft::ReactNative::ReactContext const &reactContext)
20
+ winrt::Microsoft::ReactNative::ReactContext const &reactContext,
21
+ ReactCompositionViewComponentBuilder *builder)
21
22
  : base_type(
22
23
  {}, // default viewProps
23
24
  compContext,
@@ -25,20 +26,34 @@ RootComponentView::RootComponentView(
25
26
  reactContext,
26
27
  ComponentViewFeatures::Default &
27
28
  ~(ComponentViewFeatures::Background | ComponentViewFeatures::ShadowProps |
28
- ComponentViewFeatures::NativeBorder | ComponentViewFeatures::FocusVisual)) {}
29
+ ComponentViewFeatures::NativeBorder | ComponentViewFeatures::FocusVisual),
30
+ builder) {}
31
+
32
+ RootComponentView::RootComponentView(
33
+ const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
34
+ const winrt::Microsoft::ReactNative::Composition::PortalComponentView &portal,
35
+ winrt::Microsoft::ReactNative::ReactContext const &reactContext)
36
+ : base_type(
37
+ {}, // default viewProps
38
+ compContext,
39
+ -1,
40
+ reactContext,
41
+ ComponentViewFeatures::Default &
42
+ ~(ComponentViewFeatures::Background | ComponentViewFeatures::ShadowProps |
43
+ ComponentViewFeatures::NativeBorder | ComponentViewFeatures::FocusVisual),
44
+ nullptr // builder,
45
+ ),
46
+ m_wkPortal(portal) {}
29
47
 
30
48
  RootComponentView::~RootComponentView() {
31
- if (auto rootView = m_wkRootView.get()) {
32
- winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(rootView)->RemoveRenderedVisual(
33
- OuterVisual());
34
- }
49
+ stop();
35
50
  }
36
51
 
37
52
  winrt::Microsoft::ReactNative::ComponentView RootComponentView::Create(
38
53
  const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
39
54
  facebook::react::Tag tag,
40
55
  winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept {
41
- return winrt::make<RootComponentView>(compContext, tag, reactContext);
56
+ return winrt::make<RootComponentView>(compContext, tag, reactContext, nullptr);
42
57
  }
43
58
 
44
59
  RootComponentView *RootComponentView::rootComponentView() const noexcept {
@@ -61,7 +76,9 @@ void RootComponentView::updateLayoutMetrics(
61
76
  winrt::Microsoft::ReactNative::ComponentView RootComponentView::GetFocusedComponent() noexcept {
62
77
  return m_focusedComponent;
63
78
  }
64
- void RootComponentView::SetFocusedComponent(const winrt::Microsoft::ReactNative::ComponentView &value) noexcept {
79
+ void RootComponentView::SetFocusedComponent(
80
+ const winrt::Microsoft::ReactNative::ComponentView &value,
81
+ winrt::Microsoft::ReactNative::FocusNavigationDirection direction) noexcept {
65
82
  if (m_focusedComponent == value)
66
83
  return;
67
84
 
@@ -75,7 +92,7 @@ void RootComponentView::SetFocusedComponent(const winrt::Microsoft::ReactNative:
75
92
  if (auto rootView = m_wkRootView.get()) {
76
93
  winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(rootView)->TrySetFocus();
77
94
  }
78
- auto args = winrt::make<winrt::Microsoft::ReactNative::implementation::GotFocusEventArgs>(value);
95
+ auto args = winrt::make<winrt::Microsoft::ReactNative::implementation::GotFocusEventArgs>(value, direction);
79
96
  winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(value)->onGotFocus(args);
80
97
  }
81
98
 
@@ -84,13 +101,13 @@ void RootComponentView::SetFocusedComponent(const winrt::Microsoft::ReactNative:
84
101
 
85
102
  bool RootComponentView::NavigateFocus(const winrt::Microsoft::ReactNative::FocusNavigationRequest &request) noexcept {
86
103
  if (request.Reason() == winrt::Microsoft::ReactNative::FocusNavigationReason::Restore) {
87
- // No-op for now
88
- return m_focusedComponent != nullptr;
104
+ if (m_focusedComponent)
105
+ return true;
89
106
  }
90
107
 
91
- auto view = (request.Reason() == winrt::Microsoft::ReactNative::FocusNavigationReason::First)
92
- ? FocusManager::FindFirstFocusableElement(*this)
93
- : FocusManager::FindLastFocusableElement(*this);
108
+ auto view = (request.Reason() == winrt::Microsoft::ReactNative::FocusNavigationReason::Last)
109
+ ? FocusManager::FindLastFocusableElement(*this)
110
+ : FocusManager::FindFirstFocusableElement(*this);
94
111
  if (view) {
95
112
  TrySetFocusedComponent(
96
113
  view,
@@ -103,7 +120,8 @@ bool RootComponentView::NavigateFocus(const winrt::Microsoft::ReactNative::Focus
103
120
 
104
121
  bool RootComponentView::TrySetFocusedComponent(
105
122
  const winrt::Microsoft::ReactNative::ComponentView &view,
106
- winrt::Microsoft::ReactNative::FocusNavigationDirection direction) noexcept {
123
+ winrt::Microsoft::ReactNative::FocusNavigationDirection direction,
124
+ bool forceNoSelectionIfCannotMove /*= false*/) noexcept {
107
125
  auto target = view;
108
126
  auto selfView = winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(target);
109
127
  if (selfView && !selfView->focusable()) {
@@ -111,13 +129,15 @@ bool RootComponentView::TrySetFocusedComponent(
111
129
  direction == winrt::Microsoft::ReactNative::FocusNavigationDirection::Previous)
112
130
  ? FocusManager::FindLastFocusableElement(target)
113
131
  : FocusManager::FindFirstFocusableElement(target);
114
- if (!target)
132
+ if (!target && !forceNoSelectionIfCannotMove)
115
133
  return false;
116
134
  selfView = winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(target);
117
135
  }
118
136
 
119
- if (selfView && selfView->rootComponentView() != this)
137
+ if (selfView && selfView->rootComponentView() != this) {
138
+ assert(false);
120
139
  return false;
140
+ }
121
141
 
122
142
  auto losingFocusArgs = winrt::make<winrt::Microsoft::ReactNative::implementation::LosingFocusEventArgs>(
123
143
  target, direction, m_focusedComponent, target);
@@ -134,7 +154,9 @@ bool RootComponentView::TrySetFocusedComponent(
134
154
 
135
155
  winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(losingFocusArgs.NewFocusedComponent())
136
156
  ->rootComponentView()
137
- ->SetFocusedComponent(gettingFocusArgs.NewFocusedComponent());
157
+ ->SetFocusedComponent(gettingFocusArgs.NewFocusedComponent(), direction);
158
+ } else {
159
+ SetFocusedComponent(nullptr, direction);
138
160
  }
139
161
 
140
162
  return true;
@@ -197,7 +219,7 @@ HRESULT RootComponentView::GetFragmentRoot(IRawElementProviderFragmentRoot **pRe
197
219
  if (uiManager == nullptr)
198
220
  return UIA_E_ELEMENTNOTAVAILABLE;
199
221
 
200
- auto rootView{uiManager->GetReactNativeIsland(Tag())};
222
+ auto rootView = m_wkRootView.get();
201
223
  if (!rootView) {
202
224
  return UIA_E_ELEMENTNOTAVAILABLE;
203
225
  }
@@ -214,10 +236,43 @@ uint32_t RootComponentView::overlayIndex() noexcept {
214
236
  return 1;
215
237
  }
216
238
 
217
- void RootComponentView::start(const winrt::Microsoft::ReactNative::ReactNativeIsland &rootView) noexcept {
218
- winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(rootView)->AddRenderedVisual(
239
+ void RootComponentView::start(const winrt::Microsoft::ReactNative::ReactNativeIsland &island) noexcept {
240
+ theme(winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::Theme>(island.Theme()));
241
+
242
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(island)->AddRenderedVisual(
219
243
  OuterVisual());
220
- m_wkRootView = rootView;
244
+ m_visualAddedToIsland = true;
245
+ ReactNativeIsland(island);
246
+ }
247
+
248
+ void RootComponentView::stop() noexcept {
249
+ SetFocusedComponent(nullptr, winrt::Microsoft::ReactNative::FocusNavigationDirection::None);
250
+ if (m_visualAddedToIsland) {
251
+ if (auto rootView = m_wkRootView.get()) {
252
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(rootView)->RemoveRenderedVisual(
253
+ OuterVisual());
254
+ }
255
+ m_visualAddedToIsland = false;
256
+ }
257
+ // Disconnect from the Island. In case of an instance reload, the island may now
258
+ // be attached to a new RootComponentView, so we should stop interacting with it.
259
+ ReactNativeIsland(nullptr);
260
+ }
261
+
262
+ void RootComponentView::ReactNativeIsland(const winrt::Microsoft::ReactNative::ReactNativeIsland &island) noexcept {
263
+ m_wkRootView = island;
264
+ }
265
+
266
+ winrt::Microsoft::ReactNative::ReactNativeIsland RootComponentView::ReactNativeIsland() noexcept {
267
+ return m_wkRootView.get();
268
+ }
269
+
270
+ winrt::Microsoft::ReactNative::Composition::PortalComponentView RootComponentView::Portal() const noexcept {
271
+ return m_wkPortal.get();
272
+ }
273
+
274
+ facebook::react::Point RootComponentView::getClientOffset() const noexcept {
275
+ return {};
221
276
  }
222
277
 
223
278
  winrt::IInspectable RootComponentView::UiaProviderFromPoint(const POINT &ptPixels) noexcept {
@@ -226,6 +281,10 @@ winrt::IInspectable RootComponentView::UiaProviderFromPoint(const POINT &ptPixel
226
281
  static_cast<facebook::react::Float>(ptPixels.y) / m_layoutMetrics.pointScaleFactor};
227
282
 
228
283
  facebook::react::Point localPt;
284
+
285
+ // In the case of a sub rootview, we may have a non-zero origin. hitTest takes a pt in the parent coords, so we need
286
+ // to apply the current origin
287
+ ptDips += m_layoutMetrics.frame.origin;
229
288
  auto tag = hitTest(ptDips, localPt, true);
230
289
 
231
290
  auto uiManager = ::Microsoft::ReactNative::FabricUIManager::FromProperties(m_reactContext.Properties());
@@ -27,10 +27,13 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
27
27
  winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept;
28
28
 
29
29
  winrt::Microsoft::ReactNative::ComponentView GetFocusedComponent() noexcept;
30
- void SetFocusedComponent(const winrt::Microsoft::ReactNative::ComponentView &value) noexcept;
30
+ void SetFocusedComponent(
31
+ const winrt::Microsoft::ReactNative::ComponentView &value,
32
+ winrt::Microsoft::ReactNative::FocusNavigationDirection direction) noexcept;
31
33
  bool TrySetFocusedComponent(
32
34
  const winrt::Microsoft::ReactNative::ComponentView &view,
33
- winrt::Microsoft::ReactNative::FocusNavigationDirection direction) noexcept;
35
+ winrt::Microsoft::ReactNative::FocusNavigationDirection direction,
36
+ bool forceNoSelectionIfCannotMove = false) noexcept;
34
37
 
35
38
  bool NavigateFocus(const winrt::Microsoft::ReactNative::FocusNavigationRequest &request) noexcept;
36
39
 
@@ -46,6 +49,12 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
46
49
  // Index that visuals can be inserted into OuterVisual for debugging UI
47
50
  uint32_t overlayIndex() noexcept;
48
51
  void start(const winrt::Microsoft::ReactNative::ReactNativeIsland &rootView) noexcept;
52
+ void stop() noexcept;
53
+
54
+ void ReactNativeIsland(const winrt::Microsoft::ReactNative::ReactNativeIsland &rootView) noexcept;
55
+ winrt::Microsoft::ReactNative::ReactNativeIsland ReactNativeIsland() noexcept;
56
+
57
+ facebook::react::Point getClientOffset() const noexcept override;
49
58
 
50
59
  HRESULT GetFragmentRoot(IRawElementProviderFragmentRoot **pRetVal) noexcept;
51
60
  winrt::Microsoft::ReactNative::implementation::ClipState getClipState() noexcept override;
@@ -60,8 +69,16 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
60
69
  RootComponentView(
61
70
  const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
62
71
  facebook::react::Tag tag,
72
+ winrt::Microsoft::ReactNative::ReactContext const &reactContext,
73
+ ReactCompositionViewComponentBuilder *builder);
74
+
75
+ RootComponentView(
76
+ const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
77
+ const winrt::Microsoft::ReactNative::Composition::PortalComponentView &portal,
63
78
  winrt::Microsoft::ReactNative::ReactContext const &reactContext);
64
79
 
80
+ winrt::Microsoft::ReactNative::Composition::PortalComponentView Portal() const noexcept;
81
+
65
82
  virtual ~RootComponentView();
66
83
 
67
84
  winrt::Microsoft::ReactNative::ComponentView FindFirstFocusableElement() noexcept;
@@ -75,6 +92,8 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
75
92
  // happening.
76
93
  winrt::Microsoft::ReactNative::ComponentView m_focusedComponent{nullptr};
77
94
  winrt::weak_ref<winrt::Microsoft::ReactNative::ReactNativeIsland> m_wkRootView{nullptr};
95
+ winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::PortalComponentView> m_wkPortal{nullptr};
96
+ bool m_visualAddedToIsland{false};
78
97
  };
79
98
 
80
99
  } // namespace winrt::Microsoft::ReactNative::Composition::implementation
@@ -124,7 +124,7 @@ bool Theme::TryGetPlatformColor(const std::string &platformColor, winrt::Windows
124
124
 
125
125
  #ifndef CORE_ABI
126
126
  // If XAML is loaded, look in application resources
127
- if (xaml::TryGetCurrentApplication()) {
127
+ if (xaml::TryGetCurrentUwpXamlApplication()) {
128
128
  const auto appResources{xaml::Application::Current().Resources()};
129
129
  const auto boxedResourceName{winrt::box_value(winrt::to_hstring(platformColor))};
130
130
  if (appResources.HasKey(boxedResourceName)) {
@@ -241,15 +241,20 @@ bool Theme::TryGetPlatformColor(const std::string &platformColor, winrt::Windows
241
241
  {"ButtonForegroundPressed", "TextFillColorSecondary"},
242
242
  {"ButtonForegroundPointerOver", "TextFillColorPrimary"},
243
243
  {"ButtonBackground", "ControlFillColorDefault"},
244
+ {"ButtonBorderBrush", "ButtonBorder"},
244
245
  {"ButtonBorder", "ControlElevationBorder"},
245
246
  {"ControlElevationBorder",
246
247
  "ControlStrokeColorSecondary"}, // TODO ControlElevationBorderBrush is actually gradient brush
247
248
  {"ButtonForeground", "TextFillColorPrimary"},
249
+ {"SolidBackgroundFillColorBaseBrush", "SolidBackgroundFillColorBase"},
248
250
  {"ButtonBackgroundDisabled", "ControlFillColorDisabled"},
251
+ {"ButtonBorderBrushDisabled", "ButtonBorderDisabled"},
249
252
  {"ButtonBorderDisabled", "ControlStrokeColorDefault"},
250
253
  {"ButtonForegroundDisabled", "TextFillColorDisabled"},
251
254
  {"ButtonBackgroundPointerOver", "ControlFillColorSecondary"},
255
+ {"ButtonBorderBrushPointerOver", "ButtonBorderPointerOver"},
252
256
  {"ButtonBorderPointerOver", "ControlElevationBorder"},
257
+ {"ButtonBorderBrushPressed", "ButtonBorderPressed"},
253
258
  {"ButtonBorderPressed", "ControlFillColorTransparent"},
254
259
  {"ToggleSwitchFillOff", "ControlAltFillColorSecondary"},
255
260
  {"ToggleSwitchFillOffPointerOver", "ControlAltFillColorTertiary"},
@@ -10,6 +10,7 @@
10
10
  #include <react/renderer/core/LayoutConstraints.h>
11
11
  #include <react/renderer/textlayoutmanager/TextLayoutManager.h>
12
12
  #include <winrt/Microsoft.ReactNative.Composition.h>
13
+ #include <winrt/Windows.UI.ViewManagement.h>
13
14
  #include "TextDrawing.h"
14
15
  #include "dwmapi.h"
15
16
 
@@ -49,7 +50,9 @@ facebook::react::AttributedStringBox CreateTooltipAttributedString(const std::st
49
50
  auto fragment = facebook::react::AttributedString::Fragment{};
50
51
  fragment.string = tooltip;
51
52
  fragment.textAttributes.fontSize = tooltipFontSize;
52
- attributedString.appendFragment(fragment);
53
+ fragment.textAttributes.fontSizeMultiplier =
54
+ static_cast<float>(winrt::Windows::UI::ViewManagement::UISettings().TextScaleFactor());
55
+ attributedString.appendFragment(std::move(fragment));
53
56
  return facebook::react::AttributedStringBox{attributedString};
54
57
  }
55
58
 
@@ -231,14 +234,13 @@ void TooltipTracker::OnUnmounted(
231
234
  }
232
235
 
233
236
  void TooltipTracker::ShowTooltip(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
234
- auto viewCompView = view.as<winrt::Microsoft::ReactNative::Composition::ViewComponentView>();
235
-
236
- auto selfView =
237
- winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::ViewComponentView>(viewCompView);
238
- auto parentHwnd = selfView->GetHwndForParenting();
239
237
  DestroyTimer();
240
238
 
241
239
  if (!m_hwndTip) {
240
+ auto viewCompView = view.as<winrt::Microsoft::ReactNative::Composition::ViewComponentView>();
241
+ auto selfView =
242
+ winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::ViewComponentView>(viewCompView);
243
+ auto parentHwnd = selfView->GetHwndForParenting();
242
244
  auto tooltipData = std::make_unique<TooltipData>(view);
243
245
  tooltipData->attributedString = CreateTooltipAttributedString(*selfView->viewProps()->tooltip);
244
246
 
@@ -256,37 +258,39 @@ void TooltipTracker::ShowTooltip(const winrt::Microsoft::ReactNative::ComponentV
256
258
  facebook::react::TextLayoutManager::GetTextLayout(
257
259
  tooltipData->attributedString, {} /*paragraphAttributes*/, layoutConstraints, tooltipData->textLayout);
258
260
 
259
- DWRITE_TEXT_METRICS tm;
260
- winrt::check_hresult(tooltipData->textLayout->GetMetrics(&tm));
261
-
262
- tooltipData->width =
263
- static_cast<int>(tm.width + ((tooltipHorizontalPadding + tooltipHorizontalPadding) * scaleFactor));
264
- tooltipData->height = static_cast<int>(tm.height + ((tooltipTopPadding + tooltipBottomPadding) * scaleFactor));
265
-
266
- POINT pt = {static_cast<LONG>(m_pos.X), static_cast<LONG>(m_pos.Y)};
267
- ClientToScreen(parentHwnd, &pt);
268
-
269
- RegisterTooltipWndClass();
270
- HINSTANCE hInstance = GetModuleHandle(NULL);
271
- m_hwndTip = CreateWindow(
272
- c_tooltipWindowClassName,
273
- L"Tooltip",
274
- WS_POPUP,
275
- pt.x - tooltipData->width / 2,
276
- static_cast<int>(pt.y - tooltipData->height - (toolTipPlacementMargin * scaleFactor)),
277
- tooltipData->width,
278
- tooltipData->height,
279
- parentHwnd,
280
- NULL,
281
- hInstance,
282
- tooltipData.get());
283
-
284
- DWM_WINDOW_CORNER_PREFERENCE preference = DWMWCP_ROUNDSMALL;
285
- UINT borderThickness = 0;
286
- DwmSetWindowAttribute(m_hwndTip, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference));
287
-
288
- tooltipData.release();
289
- AnimateWindow(m_hwndTip, toolTipAnimationTimeMs, AW_BLEND);
261
+ if (tooltipData->textLayout) {
262
+ DWRITE_TEXT_METRICS tm;
263
+ winrt::check_hresult(tooltipData->textLayout->GetMetrics(&tm));
264
+
265
+ tooltipData->width =
266
+ static_cast<int>((tm.width + tooltipHorizontalPadding + tooltipHorizontalPadding) * scaleFactor);
267
+ tooltipData->height = static_cast<int>((tm.height + tooltipTopPadding + tooltipBottomPadding) * scaleFactor);
268
+
269
+ POINT pt = {static_cast<LONG>(m_pos.X), static_cast<LONG>(m_pos.Y)};
270
+ ClientToScreen(parentHwnd, &pt);
271
+
272
+ RegisterTooltipWndClass();
273
+ HINSTANCE hInstance = GetModuleHandle(NULL);
274
+ m_hwndTip = CreateWindow(
275
+ c_tooltipWindowClassName,
276
+ L"Tooltip",
277
+ WS_POPUP,
278
+ pt.x - tooltipData->width / 2,
279
+ static_cast<int>(pt.y - tooltipData->height - (toolTipPlacementMargin * scaleFactor)),
280
+ tooltipData->width,
281
+ tooltipData->height,
282
+ parentHwnd,
283
+ NULL,
284
+ hInstance,
285
+ tooltipData.get());
286
+
287
+ DWM_WINDOW_CORNER_PREFERENCE preference = DWMWCP_ROUNDSMALL;
288
+ UINT borderThickness = 0;
289
+ DwmSetWindowAttribute(m_hwndTip, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference));
290
+
291
+ tooltipData.release();
292
+ AnimateWindow(m_hwndTip, toolTipAnimationTimeMs, AW_BLEND);
293
+ }
290
294
  }
291
295
  }
292
296
 
@@ -42,44 +42,59 @@ HRESULT UiaNavigateHelper(
42
42
  }
43
43
  } break;
44
44
 
45
- case NavigateDirection_LastChild:
46
- __fallthrough;
47
-
45
+ case NavigateDirection_LastChild: {
46
+ auto children = view.Children();
47
+ if (children.Size() != 0) {
48
+ uint32_t index = children.Size() - 1;
49
+ do {
50
+ auto child = children.GetAt(index).as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
51
+ if (uiaProvider = child->EnsureUiaProvider()) {
52
+ break;
53
+ }
54
+ } while (index-- != 0);
55
+ }
56
+ } break;
48
57
  case NavigateDirection_FirstChild: {
49
58
  auto children = view.Children();
50
- auto index = direction == NavigateDirection_FirstChild ? 0 : children.Size() - 1;
51
- if (!children.Size() == 0) {
52
- uiaProvider = children.GetAt(index)
53
- .as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>()
54
- ->EnsureUiaProvider();
59
+ if (children.Size() != 0) {
60
+ uint32_t index = 0;
61
+ do {
62
+ auto child = children.GetAt(index).as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
63
+ if (uiaProvider = child->EnsureUiaProvider()) {
64
+ break;
65
+ }
66
+ } while (++index != children.Size());
55
67
  }
56
68
  } break;
57
-
58
69
  case NavigateDirection_NextSibling: {
59
- auto parentCV = view.Parent().as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>();
70
+ auto parentCV = view.Parent().as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
60
71
  if (parentCV != nullptr) {
61
72
  auto children = parentCV->Children();
62
73
  auto it = std::find(children.begin(), children.end(), view);
63
- if (++it != children.end()) {
64
- uiaProvider = (*it)
65
- .as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>()
66
- ->EnsureUiaProvider();
74
+
75
+ while (++it != children.end()) {
76
+ auto nextchild = (*it).as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
77
+ if (uiaProvider = nextchild->EnsureUiaProvider()) {
78
+ break;
79
+ }
67
80
  }
68
81
  }
69
82
  } break;
70
83
 
71
84
  case NavigateDirection_PreviousSibling: {
72
- auto parentCV = view.Parent().as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>();
85
+ auto parentCV = view.Parent().as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
73
86
  if (parentCV != nullptr) {
74
87
  auto children = parentCV->Children();
75
- for (auto i = children.Size() - 1; i > 0; i--) {
76
- auto child = children.GetAt(i);
77
- if (child == view) {
78
- uiaProvider = children.GetAt(i - 1)
79
- .as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>()
80
- ->EnsureUiaProvider();
81
- break;
82
- }
88
+ auto it = std::find(children.begin(), children.end(), view);
89
+
90
+ if (it != children.begin()) {
91
+ do {
92
+ it--;
93
+ auto prevchild = (*it).as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
94
+ if (uiaProvider = prevchild->EnsureUiaProvider()) {
95
+ break;
96
+ }
97
+ } while (it != children.begin());
83
98
  }
84
99
  }
85
100
  } break;
@@ -174,16 +189,6 @@ long GetLiveSetting(const std::string &liveRegion) noexcept {
174
189
  return LiveSetting::Off;
175
190
  }
176
191
 
177
- std::string extractAccessibilityValue(const facebook::react::AccessibilityValue &value) noexcept {
178
- if (value.now.has_value()) {
179
- return std::to_string(value.now.value());
180
- } else if (value.text.has_value()) {
181
- return value.text.value();
182
- } else {
183
- return "";
184
- }
185
- }
186
-
187
192
  void DispatchAccessibilityAction(::Microsoft::ReactNative::ReactTaggedView &view, const std::string &action) noexcept {
188
193
  auto strongView = view.view();
189
194
 
@@ -214,6 +219,30 @@ ExpandCollapseState GetExpandCollapseState(const bool &expanded) noexcept {
214
219
  }
215
220
  }
216
221
 
222
+ void AddSelectionItemsToContainer(CompositionDynamicAutomationProvider *provider) noexcept {
223
+ winrt::com_ptr<IRawElementProviderSimple> selectionContainer;
224
+ provider->get_SelectionContainer(selectionContainer.put());
225
+ if (!selectionContainer)
226
+ return;
227
+ auto selectionContainerProvider = selectionContainer.as<CompositionDynamicAutomationProvider>();
228
+ auto simpleProvider = static_cast<IRawElementProviderSimple *>(provider);
229
+ winrt::com_ptr<IRawElementProviderSimple> simpleProviderPtr;
230
+ simpleProviderPtr.copy_from(simpleProvider);
231
+ selectionContainerProvider->AddToSelectionItems(simpleProviderPtr);
232
+ }
233
+
234
+ void RemoveSelectionItemsFromContainer(CompositionDynamicAutomationProvider *provider) noexcept {
235
+ winrt::com_ptr<IRawElementProviderSimple> selectionContainer;
236
+ provider->get_SelectionContainer(selectionContainer.put());
237
+ if (!selectionContainer)
238
+ return;
239
+ auto selectionContainerProvider = selectionContainer.as<CompositionDynamicAutomationProvider>();
240
+ auto simpleProvider = static_cast<IRawElementProviderSimple *>(provider);
241
+ winrt::com_ptr<IRawElementProviderSimple> simpleProviderPtr;
242
+ simpleProviderPtr.copy_from(simpleProvider);
243
+ selectionContainerProvider->RemoveFromSelectionItems(simpleProviderPtr);
244
+ }
245
+
217
246
  ToggleState GetToggleState(const std::optional<facebook::react::AccessibilityState> &state) noexcept {
218
247
  if (state.has_value()) {
219
248
  if (state->checked == facebook::react::AccessibilityState::Checked) {
@@ -225,4 +254,18 @@ ToggleState GetToggleState(const std::optional<facebook::react::AccessibilitySta
225
254
  return ToggleState::ToggleState_Off;
226
255
  }
227
256
 
257
+ TextDecorationLineStyle GetTextDecorationLineStyle(facebook::react::TextDecorationStyle style) noexcept {
258
+ if (style == facebook::react::TextDecorationStyle::Dashed) {
259
+ return TextDecorationLineStyle_Dash;
260
+ } else if (style == facebook::react::TextDecorationStyle::Dotted) {
261
+ return TextDecorationLineStyle_Dot;
262
+ } else if (style == facebook::react::TextDecorationStyle::Double) {
263
+ return TextDecorationLineStyle_Double;
264
+ } else if (style == facebook::react::TextDecorationStyle::Solid) {
265
+ return TextDecorationLineStyle_Single;
266
+ } else {
267
+ return TextDecorationLineStyle_Single;
268
+ }
269
+ }
270
+
228
271
  } // namespace winrt::Microsoft::ReactNative::implementation
@@ -1,6 +1,8 @@
1
1
  #pragma once
2
2
 
3
3
  #include <Fabric/ComponentView.h>
4
+ #include <Fabric/Composition/CompositionDynamicAutomationProvider.h>
5
+ #include <Fabric/Composition/ParagraphComponentView.h>
4
6
  #include <Fabric/ReactTaggedView.h>
5
7
  #include <UIAutomation.h>
6
8
 
@@ -31,11 +33,15 @@ void UpdateUiaProperty(
31
33
 
32
34
  long GetLiveSetting(const std::string &liveRegion) noexcept;
33
35
 
34
- std::string extractAccessibilityValue(const facebook::react::AccessibilityValue &value) noexcept;
35
-
36
36
  void DispatchAccessibilityAction(::Microsoft::ReactNative::ReactTaggedView &view, const std::string &action) noexcept;
37
37
 
38
38
  ExpandCollapseState GetExpandCollapseState(const bool &expanded) noexcept;
39
39
 
40
+ void AddSelectionItemsToContainer(CompositionDynamicAutomationProvider *provider) noexcept;
41
+
42
+ void RemoveSelectionItemsFromContainer(CompositionDynamicAutomationProvider *provider) noexcept;
43
+
40
44
  ToggleState GetToggleState(const std::optional<facebook::react::AccessibilityState> &state) noexcept;
45
+
46
+ TextDecorationLineStyle GetTextDecorationLineStyle(facebook::react::TextDecorationStyle style) noexcept;
41
47
  } // namespace winrt::Microsoft::ReactNative::implementation
@@ -136,7 +136,6 @@ void FabricUIManager::startSurface(
136
136
 
137
137
  auto root = rootComponentViewDescriptor.view
138
138
  .as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>();
139
- root->theme(winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::Theme>(rootView.Theme()));
140
139
  root->start(rootView);
141
140
  });
142
141
 
@@ -156,15 +155,11 @@ void FabricUIManager::startSurface(
156
155
  void FabricUIManager::stopSurface(facebook::react::SurfaceId surfaceId) noexcept {
157
156
  m_surfaceManager->stopSurface(surfaceId);
158
157
  auto &rootDescriptor = m_registry.componentViewDescriptorWithTag(surfaceId);
158
+ rootDescriptor.view.as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>()->stop();
159
159
  m_registry.enqueueComponentViewWithComponentHandle(
160
160
  facebook::react::RootShadowNode::Handle(), surfaceId, rootDescriptor);
161
161
  }
162
162
 
163
- winrt::Microsoft::ReactNative::ReactNativeIsland FabricUIManager::GetReactNativeIsland(
164
- facebook::react::SurfaceId surfaceId) const noexcept {
165
- return m_surfaceRegistry.at(surfaceId).wkRootView.get();
166
- }
167
-
168
163
  facebook::react::Size FabricUIManager::measureSurface(
169
164
  facebook::react::SurfaceId surfaceId,
170
165
  const facebook::react::LayoutConstraints &layoutConstraints,
@@ -49,9 +49,6 @@ struct FabricUIManager final : public std::enable_shared_from_this<FabricUIManag
49
49
 
50
50
  const IComponentViewRegistry &GetViewRegistry() const noexcept;
51
51
 
52
- winrt::Microsoft::ReactNative::ReactNativeIsland GetReactNativeIsland(
53
- facebook::react::SurfaceId surfaceId) const noexcept;
54
-
55
52
  static winrt::Microsoft::ReactNative::ReactNotificationId<facebook::react::SurfaceId> NotifyMountedId() noexcept;
56
53
 
57
54
  private:
@@ -6,7 +6,6 @@
6
6
 
7
7
  #include <Fabric/AbiComponentDescriptor.h>
8
8
  #include <Fabric/AbiViewComponentDescriptor.h>
9
- #include <Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h>
10
9
  #include <Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h>
11
10
  #include <react/components/rnwcore/ComponentDescriptors.h>
12
11
  #include <react/renderer/components/image/ImageComponentDescriptor.h>
@@ -37,7 +36,6 @@ WindowsComponentDescriptorRegistry::WindowsComponentDescriptorRegistry()
37
36
  facebook::react::ActivityIndicatorViewComponentDescriptor>());
38
37
  add(facebook::react::concreteComponentDescriptorProvider<facebook::react::DebuggingOverlayComponentDescriptor>());
39
38
  add(facebook::react::concreteComponentDescriptorProvider<facebook::react::ImageComponentDescriptor>());
40
- add(facebook::react::concreteComponentDescriptorProvider<facebook::react::WindowsModalHostViewComponentDescriptor>());
41
39
  add(facebook::react::concreteComponentDescriptorProvider<facebook::react::ParagraphComponentDescriptor>());
42
40
  add(facebook::react::concreteComponentDescriptorProvider<facebook::react::RawTextComponentDescriptor>());
43
41
  add(facebook::react::concreteComponentDescriptorProvider<facebook::react::ScrollViewComponentDescriptor>());
@@ -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
  }