react-native-windows 0.81.1 → 0.81.3

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 (59) hide show
  1. package/Libraries/Components/Pressable/Pressable.d.ts +8 -0
  2. package/Libraries/Components/Pressable/Pressable.windows.js +21 -2
  3. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +26 -0
  4. package/Microsoft.ReactNative/Fabric/ComponentView.h +2 -0
  5. package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +0 -1
  6. package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.cpp +2 -5
  7. package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.h +1 -4
  8. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +65 -32
  9. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +9 -0
  10. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +8 -0
  11. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +2 -1
  12. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.cpp +4 -7
  13. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.h +1 -5
  14. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp +68 -53
  15. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.h +1 -5
  16. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +18 -14
  17. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +10 -3
  18. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +30 -8
  19. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +4 -1
  20. package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +3 -2
  21. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +0 -1
  22. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +550 -4
  23. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +52 -0
  24. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +8 -0
  25. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +3 -0
  26. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +53 -2
  27. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +8 -1
  28. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +0 -1
  29. package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +0 -1
  30. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +3 -1
  31. package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +6 -0
  32. package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +1 -1
  33. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +28 -10
  34. package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +0 -1
  35. package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +1 -1
  36. package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.h +2 -1
  37. package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +8 -0
  38. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -0
  39. package/Microsoft.ReactNative/Utils/IcuUtils.cpp +84 -0
  40. package/Microsoft.ReactNative/Utils/IcuUtils.h +42 -0
  41. package/Microsoft.ReactNative.Cxx/StructInfo.h +8 -1
  42. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  43. package/Shared/Shared.vcxitems +1 -0
  44. package/Shared/Shared.vcxitems.filters +1 -0
  45. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +14 -0
  46. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +14 -0
  47. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +14 -0
  48. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +14 -0
  49. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +14 -0
  50. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +14 -0
  51. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +14 -0
  52. package/codegen/react/components/rnwcore/InputAccessory.g.h +14 -0
  53. package/codegen/react/components/rnwcore/ModalHostView.g.h +14 -0
  54. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +14 -0
  55. package/codegen/react/components/rnwcore/SafeAreaView.g.h +14 -0
  56. package/codegen/react/components/rnwcore/Switch.g.h +14 -0
  57. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +14 -0
  58. package/codegen/react/components/rnwcore/VirtualView.g.h +14 -0
  59. package/package.json +4 -4
@@ -1,6 +1,5 @@
1
1
  #pragma once
2
2
 
3
- #include <Fabric/Composition/CompositionDynamicAutomationProvider.h>
4
3
  #include <Fabric/Composition/CompositionTextProvider.h>
5
4
  #include <Fabric/Composition/CompositionViewComponentView.h>
6
5
  #include <Fabric/ReactTaggedView.h>
@@ -12,9 +11,7 @@ namespace winrt::Microsoft::ReactNative::implementation {
12
11
 
13
12
  class CompositionTextRangeProvider : public winrt::implements<CompositionTextRangeProvider, ITextRangeProvider> {
14
13
  public:
15
- CompositionTextRangeProvider(
16
- const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView,
17
- CompositionDynamicAutomationProvider *parentProvider) noexcept;
14
+ CompositionTextRangeProvider(const winrt::Microsoft::ReactNative::ComponentView &componentView) noexcept;
18
15
 
19
16
  // inherited via ITextRangeProvider
20
17
  virtual HRESULT __stdcall Clone(ITextRangeProvider **pRetVal) override;
@@ -53,7 +50,6 @@ class CompositionTextRangeProvider : public winrt::implements<CompositionTextRan
53
50
 
54
51
  private:
55
52
  ::Microsoft::ReactNative::ReactTaggedView m_view;
56
- winrt::com_ptr<CompositionDynamicAutomationProvider> m_parentProvider;
57
53
  };
58
54
 
59
55
  } // namespace winrt::Microsoft::ReactNative::implementation
@@ -801,8 +801,8 @@ void ComponentView::updateAccessibilityProps(
801
801
  winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
802
802
  EnsureUiaProvider(),
803
803
  UIA_LiveSettingPropertyId,
804
- oldViewProps.accessibilityLiveRegion,
805
- newViewProps.accessibilityLiveRegion);
804
+ winrt::Microsoft::ReactNative::implementation::GetLiveSetting(oldViewProps.accessibilityLiveRegion),
805
+ winrt::Microsoft::ReactNative::implementation::GetLiveSetting(newViewProps.accessibilityLiveRegion));
806
806
 
807
807
  winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
808
808
  EnsureUiaProvider(), UIA_LevelPropertyId, oldViewProps.accessibilityLevel, newViewProps.accessibilityLevel);
@@ -857,14 +857,13 @@ void ComponentView::updateAccessibilityProps(
857
857
 
858
858
  if ((oldViewProps.accessibilityState.has_value() && oldViewProps.accessibilityState->selected.has_value()) !=
859
859
  ((newViewProps.accessibilityState.has_value() && newViewProps.accessibilityState->selected.has_value()))) {
860
- auto compProvider =
861
- EnsureUiaProvider()
862
- .try_as<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>();
863
- if (compProvider) {
860
+ EnsureUiaProvider();
861
+ if (m_innerAutomationProvider) {
864
862
  if ((newViewProps.accessibilityState.has_value() && newViewProps.accessibilityState->selected.has_value())) {
865
- winrt::Microsoft::ReactNative::implementation::AddSelectionItemsToContainer(compProvider.get());
863
+ winrt::Microsoft::ReactNative::implementation::AddSelectionItemsToContainer(m_innerAutomationProvider.get());
866
864
  } else {
867
- winrt::Microsoft::ReactNative::implementation::RemoveSelectionItemsFromContainer(compProvider.get());
865
+ winrt::Microsoft::ReactNative::implementation::RemoveSelectionItemsFromContainer(
866
+ m_innerAutomationProvider.get());
868
867
  }
869
868
  }
870
869
  }
@@ -1354,12 +1353,17 @@ std::string ViewComponentView::DefaultControlType() const noexcept {
1354
1353
  return "group";
1355
1354
  }
1356
1355
 
1357
- winrt::IInspectable ComponentView::EnsureUiaProvider() noexcept {
1358
- if (m_uiaProvider == nullptr) {
1359
- m_uiaProvider =
1360
- winrt::make<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>(*get_strong());
1361
- }
1362
- return m_uiaProvider;
1356
+ winrt::Windows::Foundation::IInspectable ComponentView::CreateAutomationProvider() noexcept {
1357
+ Assert(!m_innerAutomationProvider);
1358
+ m_innerAutomationProvider =
1359
+ winrt::make_self<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>(
1360
+ *get_strong());
1361
+ return *m_innerAutomationProvider;
1362
+ }
1363
+
1364
+ const winrt::com_ptr<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>
1365
+ &ComponentView::InnerAutomationProvider() const noexcept {
1366
+ return m_innerAutomationProvider;
1363
1367
  }
1364
1368
 
1365
1369
  bool IntersectRect(RECT *prcDst, const RECT &prcSrc1, const RECT &prcSrc2) {
@@ -19,8 +19,11 @@ namespace Microsoft::ReactNative {
19
19
  struct CompContext;
20
20
  } // namespace Microsoft::ReactNative
21
21
 
22
- namespace winrt::Microsoft::ReactNative::Composition::implementation {
22
+ namespace winrt::Microsoft::ReactNative::implementation {
23
+ class CompositionDynamicAutomationProvider;
24
+ }
23
25
 
26
+ namespace winrt::Microsoft::ReactNative::Composition::implementation {
24
27
  struct FocusPrimitive {
25
28
  std::shared_ptr<BorderPrimitive> m_focusInnerPrimitive;
26
29
  std::shared_ptr<BorderPrimitive> m_focusOuterPrimitive;
@@ -100,7 +103,9 @@ struct ComponentView : public ComponentViewT<
100
103
  comp::CompositionPropertySet EnsureCenterPointPropertySet() noexcept;
101
104
  void EnsureTransformMatrixFacade() noexcept;
102
105
 
103
- winrt::IInspectable EnsureUiaProvider() noexcept override;
106
+ winrt::Windows::Foundation::IInspectable CreateAutomationProvider() noexcept override;
107
+ const winrt::com_ptr<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>
108
+ &InnerAutomationProvider() const noexcept;
104
109
  std::optional<std::string> getAccessiblityValue() noexcept override;
105
110
  void setAcccessiblityValue(std::string &&value) noexcept override;
106
111
  bool getAcccessiblityIsReadOnly() noexcept override;
@@ -130,7 +135,9 @@ struct ComponentView : public ComponentViewT<
130
135
  facebook::react::Point &ptContent,
131
136
  facebook::react::Point &localPt) const noexcept;
132
137
 
133
- winrt::IInspectable m_uiaProvider{nullptr};
138
+ // Most access should be through EnsureUIAProvider, instead of direct access to this.
139
+ winrt::com_ptr<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>
140
+ m_innerAutomationProvider;
134
141
  winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext m_compContext;
135
142
  comp::CompositionPropertySet m_centerPropSet{nullptr};
136
143
  facebook::react::SharedViewEventEmitter m_eventEmitter;
@@ -111,12 +111,11 @@ void ContentIslandComponentView::ParentLayoutChanged() noexcept {
111
111
  });
112
112
  }
113
113
 
114
- winrt::IInspectable ContentIslandComponentView::EnsureUiaProvider() noexcept {
115
- if (m_uiaProvider == nullptr) {
116
- m_uiaProvider = winrt::make<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>(
117
- *get_strong(), m_childSiteLink);
118
- }
119
- return m_uiaProvider;
114
+ winrt::Windows::Foundation::IInspectable ContentIslandComponentView::CreateAutomationProvider() noexcept {
115
+ m_innerAutomationProvider =
116
+ winrt::make_self<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>(
117
+ *get_strong(), m_childSiteLink);
118
+ return *m_innerAutomationProvider;
120
119
  }
121
120
 
122
121
  bool ContentIslandComponentView::focusable() const noexcept {
@@ -126,6 +125,27 @@ bool ContentIslandComponentView::focusable() const noexcept {
126
125
  return true;
127
126
  }
128
127
 
128
+ facebook::react::Tag ContentIslandComponentView::hitTest(
129
+ facebook::react::Point pt,
130
+ facebook::react::Point &localPt,
131
+ bool ignorePointerEvents) const noexcept {
132
+ facebook::react::Point ptLocal{pt.x - m_layoutMetrics.frame.origin.x, pt.y - m_layoutMetrics.frame.origin.y};
133
+
134
+ // Check if the point is within the bounds of this ContentIslandComponentView.
135
+ // This ensures that hit tests correctly return this view's tag for UIA purposes,
136
+ // even when the actual content (XAML buttons, etc.) is hosted in the ContentIsland.
137
+ auto props = viewProps();
138
+ if ((ignorePointerEvents || props->pointerEvents == facebook::react::PointerEventsMode::Auto ||
139
+ props->pointerEvents == facebook::react::PointerEventsMode::BoxOnly) &&
140
+ ptLocal.x >= 0 && ptLocal.x <= m_layoutMetrics.frame.size.width && ptLocal.y >= 0 &&
141
+ ptLocal.y <= m_layoutMetrics.frame.size.height) {
142
+ localPt = ptLocal;
143
+ return Tag();
144
+ }
145
+
146
+ return -1;
147
+ }
148
+
129
149
  // Helper to convert a FocusNavigationDirection to a FocusNavigationReason.
130
150
  winrt::Microsoft::UI::Input::FocusNavigationReason GetFocusNavigationReason(
131
151
  winrt::Microsoft::ReactNative::FocusNavigationDirection direction) noexcept {
@@ -178,14 +198,12 @@ ContentIslandComponentView::~ContentIslandComponentView() noexcept {
178
198
  void ContentIslandComponentView::MountChildComponentView(
179
199
  const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
180
200
  uint32_t index) noexcept {
181
- assert(false);
182
201
  base_type::MountChildComponentView(childComponentView, index);
183
202
  }
184
203
 
185
204
  void ContentIslandComponentView::UnmountChildComponentView(
186
205
  const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
187
206
  uint32_t index) noexcept {
188
- assert(false);
189
207
  base_type::UnmountChildComponentView(childComponentView, index);
190
208
  }
191
209
 
@@ -262,6 +280,10 @@ void ContentIslandComponentView::ConfigureChildSiteLinkAutomation() noexcept {
262
280
  args.AutomationProvider(nullptr);
263
281
  args.Handled(true);
264
282
  });
283
+
284
+ if (m_innerAutomationProvider) {
285
+ m_innerAutomationProvider->SetChildSiteLink(m_childSiteLink);
286
+ }
265
287
  }
266
288
 
267
289
  } // namespace winrt::Microsoft::ReactNative::Composition::implementation
@@ -40,7 +40,10 @@ struct ContentIslandComponentView : ContentIslandComponentViewT<ContentIslandCom
40
40
 
41
41
  bool focusable() const noexcept override;
42
42
 
43
- winrt::Windows::Foundation::IInspectable EnsureUiaProvider() noexcept override;
43
+ facebook::react::Tag hitTest(facebook::react::Point pt, facebook::react::Point &localPt, bool ignorePointerEvents)
44
+ const noexcept override;
45
+
46
+ winrt::Windows::Foundation::IInspectable CreateAutomationProvider() noexcept override;
44
47
 
45
48
  void onGotFocus(const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept override;
46
49
 
@@ -86,10 +86,11 @@ void DebuggingOverlayComponentView::HandleCommand(
86
86
  if (auto root = rootComponentView()) {
87
87
  auto rootVisual = root->OuterVisual();
88
88
  auto brush = m_compContext.CreateColorBrush({204, 200, 230, 255});
89
+ float scaleFactor = m_layoutMetrics.pointScaleFactor;
89
90
  for (auto &element : elements) {
90
91
  auto overlayVisual = m_compContext.CreateSpriteVisual();
91
- overlayVisual.Size({element.width, element.height});
92
- overlayVisual.Offset({element.x, element.y, 0.0f});
92
+ overlayVisual.Size({element.width * scaleFactor, element.height * scaleFactor});
93
+ overlayVisual.Offset({element.x * scaleFactor, element.y * scaleFactor, 0.0f});
93
94
  overlayVisual.Brush(brush);
94
95
 
95
96
  rootVisual.InsertAt(overlayVisual, root->overlayIndex() + m_activeOverlays);
@@ -22,7 +22,6 @@
22
22
  #include <winrt/Windows.UI.Composition.h>
23
23
  #include <winrt/Windows.Web.Http.Headers.h>
24
24
  #include <winrt/Windows.Web.Http.h>
25
- #include "CompositionDynamicAutomationProvider.h"
26
25
  #include "CompositionHelpers.h"
27
26
  #include "RootComponentView.h"
28
27