react-native-windows 0.81.3 → 0.81.4

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 (22) hide show
  1. package/Microsoft.ReactNative/ABIViewManager.cpp +12 -1
  2. package/Microsoft.ReactNative/CompositionSwitcher.idl +16 -9
  3. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +15 -0
  4. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +80 -1
  5. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +43 -2
  6. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +7 -0
  7. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +71 -12
  8. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +11 -0
  9. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +8 -4
  10. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +41 -15
  11. package/Mso/src/dispatchQueue/queueService.cpp +3 -1
  12. package/Mso/src/dispatchQueue/uiScheduler_winrt.cpp +2 -1
  13. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  14. package/Shared/Networking/OriginPolicyHttpFilter.cpp +2 -1
  15. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +20 -20
  16. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +4 -4
  17. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +4 -4
  18. package/codegen/react/components/rnwcore/ModalHostView.g.h +18 -18
  19. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +4 -4
  20. package/codegen/react/components/rnwcore/Switch.g.h +4 -4
  21. package/codegen/react/components/rnwcore/VirtualView.g.h +34 -6
  22. package/package.json +3 -3
@@ -190,8 +190,19 @@ void ABIViewManager::AddView(const xaml::DependencyObject &parent, const xaml::D
190
190
  }
191
191
 
192
192
  void ABIViewManager::RemoveAllChildren(const xaml::DependencyObject &parent) {
193
+ if (!parent) {
194
+ return;
195
+ }
196
+
193
197
  if (m_viewManagerWithChildren) {
194
- m_viewManagerWithChildren.RemoveAllChildren(parent.as<xaml::FrameworkElement>());
198
+ auto fe = parent.try_as<xaml::FrameworkElement>();
199
+ if (fe) {
200
+ try {
201
+ m_viewManagerWithChildren.RemoveAllChildren(fe);
202
+ } catch (...) {
203
+ // External view manager may fail during shutdown if view is already disposed
204
+ }
205
+ }
195
206
  } else {
196
207
  Super::RemoveAllChildren(parent);
197
208
  }
@@ -45,9 +45,16 @@ enum SnapPointsAlignment {
45
45
  void Opacity(Single value);
46
46
  void BlurRadius(Single value);
47
47
  void Color(Windows.UI.Color value);
48
+ void Mask(IBrush mask);
49
+ void SourcePolicy(CompositionDropShadowSourcePolicy policy);
48
50
  }
49
51
 
50
- [webhosthidden][experimental] interface IVisual {
52
+ [webhosthidden][experimental] enum CompositionDropShadowSourcePolicy {
53
+ Default = 0,
54
+ InheritedOnly = 1
55
+ };
56
+
57
+ [webhosthidden][experimental] interface IVisual {
51
58
  void InsertAt(IVisual visual, Int32 index);
52
59
  void Remove(IVisual visual);
53
60
  IVisual GetAt(UInt32 index);
@@ -72,14 +79,14 @@ enum SnapPointsAlignment {
72
79
  void AnimationClass(AnimationClass value);
73
80
  }
74
81
 
75
- [webhosthidden][experimental] interface ISpriteVisual
82
+ [webhosthidden][experimental] interface ISpriteVisual
76
83
  requires IVisual
77
84
  {
78
85
  void Brush(IBrush brush);
79
86
  void Shadow(IDropShadow shadow);
80
87
  }
81
88
 
82
- [webhosthidden][experimental] interface IRoundedRectangleVisual
89
+ [webhosthidden][experimental] interface IRoundedRectangleVisual
83
90
  requires IVisual
84
91
  {
85
92
  void Brush(IBrush brush);
@@ -88,13 +95,13 @@ enum SnapPointsAlignment {
88
95
  void StrokeThickness(Single value);
89
96
  }
90
97
 
91
- [webhosthidden][experimental] interface IScrollPositionChangedArgs {
98
+ [webhosthidden][experimental] interface IScrollPositionChangedArgs {
92
99
  Windows.Foundation.Numerics.Vector2 Position {
93
100
  get;
94
101
  };
95
102
  }
96
103
 
97
- [webhosthidden][experimental] interface IScrollVisual
104
+ [webhosthidden][experimental] interface IScrollVisual
98
105
  requires IVisual
99
106
  {
100
107
  void Brush(IBrush brush);
@@ -122,7 +129,7 @@ enum SnapPointsAlignment {
122
129
  void SnapToAlignment(SnapPointsAlignment alignment);
123
130
  }
124
131
 
125
- [webhosthidden][experimental] interface IActivityVisual
132
+ [webhosthidden][experimental] interface IActivityVisual
126
133
  requires IVisual
127
134
  {
128
135
  void Size(Single value);
@@ -131,7 +138,7 @@ enum SnapPointsAlignment {
131
138
  void StopAnimation();
132
139
  }
133
140
 
134
- [webhosthidden][experimental] interface ICaretVisual {
141
+ [webhosthidden][experimental] interface ICaretVisual {
135
142
  IVisual InnerVisual {
136
143
  get;
137
144
  };
@@ -144,7 +151,7 @@ enum SnapPointsAlignment {
144
151
  void Brush(IBrush brush);
145
152
  }
146
153
 
147
- [webhosthidden][experimental] interface IFocusVisual {
154
+ [webhosthidden][experimental] interface IFocusVisual {
148
155
  IVisual InnerVisual {
149
156
  get;
150
157
  };
@@ -158,7 +165,7 @@ enum SnapPointsAlignment {
158
165
  };
159
166
  }
160
167
 
161
- [webhosthidden][experimental] interface ICompositionContext {
168
+ [webhosthidden][experimental] interface ICompositionContext {
162
169
  ISpriteVisual CreateSpriteVisual();
163
170
  IScrollVisual CreateScrollerVisual();
164
171
  IRoundedRectangleVisual CreateRoundedRectangleVisual();
@@ -54,6 +54,7 @@ struct CompositionTypeTraits<WindowsTypeTag> {
54
54
  using CompositionStretch = winrt::Windows::UI::Composition::CompositionStretch;
55
55
  using CompositionStrokeCap = winrt::Windows::UI::Composition::CompositionStrokeCap;
56
56
  using CompositionSurfaceBrush = winrt::Windows::UI::Composition::CompositionSurfaceBrush;
57
+ using CompositionDropShadowSourcePolicy = winrt::Windows::UI::Composition::CompositionDropShadowSourcePolicy;
57
58
  using Compositor = winrt::Windows::UI::Composition::Compositor;
58
59
  using ContainerVisual = winrt::Windows::UI::Composition::ContainerVisual;
59
60
  using CubicBezierEasingFunction = winrt::Windows::UI::Composition::CubicBezierEasingFunction;
@@ -127,6 +128,7 @@ struct CompositionTypeTraits<MicrosoftTypeTag> {
127
128
  using CompositionStretch = winrt::Microsoft::UI::Composition::CompositionStretch;
128
129
  using CompositionStrokeCap = winrt::Microsoft::UI::Composition::CompositionStrokeCap;
129
130
  using CompositionSurfaceBrush = winrt::Microsoft::UI::Composition::CompositionSurfaceBrush;
131
+ using CompositionDropShadowSourcePolicy = winrt::Microsoft::UI::Composition::CompositionDropShadowSourcePolicy;
130
132
  using Compositor = winrt::Microsoft::UI::Composition::Compositor;
131
133
  using ContainerVisual = winrt::Microsoft::UI::Composition::ContainerVisual;
132
134
  using CubicBezierEasingFunction = winrt::Microsoft::UI::Composition::CubicBezierEasingFunction;
@@ -224,6 +226,19 @@ struct CompDropShadow : public winrt::implements<
224
226
  m_shadow.Color(color);
225
227
  }
226
228
 
229
+ void Mask(winrt::Microsoft::ReactNative::Composition::Experimental::IBrush const &mask) noexcept {
230
+ if (mask) {
231
+ m_shadow.Mask(mask.as<typename TTypeRedirects::IInnerCompositionBrush>()->InnerBrush());
232
+ } else {
233
+ m_shadow.Mask(nullptr);
234
+ }
235
+ }
236
+
237
+ void SourcePolicy(
238
+ winrt::Microsoft::ReactNative::Composition::Experimental::CompositionDropShadowSourcePolicy policy) noexcept {
239
+ m_shadow.SourcePolicy(static_cast<typename TTypeRedirects::CompositionDropShadowSourcePolicy>(policy));
240
+ }
241
+
227
242
  private:
228
243
  typename TTypeRedirects::DropShadow m_shadow;
229
244
  };
@@ -710,7 +710,86 @@ void ComponentView::applyShadowProps(const facebook::react::ViewProps &viewProps
710
710
  shadow.Color(theme()->Color(*viewProps.shadowColor));
711
711
  }
712
712
 
713
- Visual().as<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual>().Shadow(shadow);
713
+ // Check if any border radius is set
714
+ auto borderMetrics = BorderPrimitive::resolveAndAlignBorderMetrics(m_layoutMetrics, viewProps);
715
+ bool hasBorderRadius = borderMetrics.borderRadii.topLeft.horizontal != 0 ||
716
+ borderMetrics.borderRadii.topRight.horizontal != 0 || borderMetrics.borderRadii.bottomLeft.horizontal != 0 ||
717
+ borderMetrics.borderRadii.bottomRight.horizontal != 0 || borderMetrics.borderRadii.topLeft.vertical != 0 ||
718
+ borderMetrics.borderRadii.topRight.vertical != 0 || borderMetrics.borderRadii.bottomLeft.vertical != 0 ||
719
+ borderMetrics.borderRadii.bottomRight.vertical != 0;
720
+
721
+ if (hasBorderRadius) {
722
+ // When borderRadius is set, we need to create a shadow mask that follows the rounded rectangle shape.
723
+ // Use CompositionVisualSurface to capture the clipped visual's appearance as the shadow mask.
724
+ bool maskSet = false;
725
+
726
+ // Try Microsoft (WinUI3) Composition first
727
+ auto msCompositor =
728
+ winrt::Microsoft::ReactNative::Composition::Experimental::MicrosoftCompositionContextHelper::InnerCompositor(
729
+ m_compContext);
730
+ if (msCompositor) {
731
+ auto innerVisual =
732
+ winrt::Microsoft::ReactNative::Composition::Experimental::MicrosoftCompositionContextHelper::InnerVisual(
733
+ Visual());
734
+ if (innerVisual) {
735
+ // Create a VisualSurface that captures the visual (with its clip applied)
736
+ auto visualSurface = msCompositor.CreateVisualSurface();
737
+ visualSurface.SourceVisual(innerVisual);
738
+ visualSurface.SourceSize(
739
+ {m_layoutMetrics.frame.size.width * m_layoutMetrics.pointScaleFactor,
740
+ m_layoutMetrics.frame.size.height * m_layoutMetrics.pointScaleFactor});
741
+
742
+ // Create a brush from the visual surface to use as shadow mask
743
+ auto maskBrush = msCompositor.CreateSurfaceBrush(visualSurface);
744
+ maskBrush.Stretch(winrt::Microsoft::UI::Composition::CompositionStretch::Fill);
745
+
746
+ // Get the inner shadow and set the mask
747
+ auto innerShadow = winrt::Microsoft::ReactNative::Composition::Experimental::MicrosoftCompositionContextHelper::
748
+ InnerDropShadow(shadow);
749
+ if (innerShadow) {
750
+ innerShadow.Mask(maskBrush);
751
+ maskSet = true;
752
+ }
753
+ }
754
+ }
755
+
756
+ // Fallback to System (Windows.UI) Composition if Microsoft Composition is not available
757
+ if (!maskSet) {
758
+ auto sysCompositor =
759
+ winrt::Microsoft::ReactNative::Composition::Experimental::SystemCompositionContextHelper::InnerCompositor(
760
+ m_compContext);
761
+ if (sysCompositor) {
762
+ auto innerVisual =
763
+ winrt::Microsoft::ReactNative::Composition::Experimental::SystemCompositionContextHelper::InnerVisual(
764
+ Visual());
765
+ if (innerVisual) {
766
+ auto visualSurface = sysCompositor.CreateVisualSurface();
767
+ visualSurface.SourceVisual(innerVisual);
768
+ visualSurface.SourceSize(
769
+ {m_layoutMetrics.frame.size.width * m_layoutMetrics.pointScaleFactor,
770
+ m_layoutMetrics.frame.size.height * m_layoutMetrics.pointScaleFactor});
771
+
772
+ auto maskBrush = sysCompositor.CreateSurfaceBrush(visualSurface);
773
+ maskBrush.Stretch(winrt::Windows::UI::Composition::CompositionStretch::Fill);
774
+
775
+ auto innerShadow =
776
+ winrt::Microsoft::ReactNative::Composition::Experimental::SystemCompositionContextHelper::InnerDropShadow(
777
+ shadow);
778
+ if (innerShadow) {
779
+ innerShadow.Mask(maskBrush);
780
+ }
781
+ }
782
+ }
783
+ }
784
+
785
+ // Apply shadow to OuterVisual (which is not clipped) so the shadow can extend beyond the clip
786
+ OuterVisual().as<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual>().Shadow(shadow);
787
+ Visual().as<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual>().Shadow(nullptr);
788
+ } else {
789
+ // No border radius - apply shadow directly to Visual (original behavior)
790
+ Visual().as<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual>().Shadow(shadow);
791
+ OuterVisual().as<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual>().Shadow(nullptr);
792
+ }
714
793
  }
715
794
 
716
795
  void ComponentView::updateTransformProps(
@@ -43,9 +43,19 @@ ContentIslandComponentView::ContentIslandComponentView(
43
43
  });
44
44
  }
45
45
 
46
- void ContentIslandComponentView::OnMounted() noexcept {
46
+ winrt::Microsoft::UI::Content::ContentIsland ContentIslandComponentView::ParentContentIsland() noexcept {
47
+ auto root = rootComponentView();
48
+ if (!root)
49
+ return nullptr;
50
+ return root->parentContentIsland();
51
+ }
52
+
53
+ void ContentIslandComponentView::ConnectInternal() noexcept {
54
+ if (!m_islandToConnect)
55
+ return;
56
+
47
57
  m_childSiteLink = winrt::Microsoft::UI::Content::ChildSiteLink::Create(
48
- rootComponentView()->parentContentIsland(),
58
+ m_parentContentIsland,
49
59
  winrt::Microsoft::ReactNative::Composition::Experimental::CompositionContextHelper::InnerVisual(Visual())
50
60
  .as<winrt::Microsoft::UI::Composition::ContainerVisual>());
51
61
  m_childSiteLink.ActualSize({m_layoutMetrics.frame.size.width, m_layoutMetrics.frame.size.height});
@@ -69,6 +79,7 @@ void ContentIslandComponentView::OnMounted() noexcept {
69
79
  m_childSiteLink.Connect(m_islandToConnect);
70
80
  m_islandToConnect = nullptr;
71
81
  }
82
+ UnregisterForRootIslandEvents();
72
83
 
73
84
  ParentLayoutChanged();
74
85
  auto view = Parent();
@@ -85,12 +96,42 @@ void ContentIslandComponentView::OnMounted() noexcept {
85
96
  }
86
97
  }
87
98
 
99
+ void ContentIslandComponentView::RegisterForRootIslandEvents() noexcept {
100
+ m_parentContentIsland = ParentContentIsland();
101
+
102
+ if (m_parentContentIsland.IsConnected()) {
103
+ ConnectInternal();
104
+ } else {
105
+ m_islandStateChangedToken = m_parentContentIsland.StateChanged(
106
+ [wkThis = get_weak()](
107
+ const winrt::Microsoft::UI::Content::ContentIsland & /*island*/,
108
+ const winrt::Microsoft::UI::Content::ContentIslandStateChangedEventArgs & /*args*/) {
109
+ if (auto strongThis = wkThis.get()) {
110
+ strongThis->ConnectInternal();
111
+ }
112
+ });
113
+ }
114
+ }
115
+
116
+ void ContentIslandComponentView::UnregisterForRootIslandEvents() noexcept {
117
+ if (m_islandStateChangedToken) {
118
+ m_parentContentIsland.StateChanged(m_islandStateChangedToken);
119
+ m_islandStateChangedToken = {};
120
+ m_parentContentIsland = nullptr;
121
+ }
122
+ }
123
+
124
+ void ContentIslandComponentView::OnMounted() noexcept {
125
+ RegisterForRootIslandEvents();
126
+ }
127
+
88
128
  void ContentIslandComponentView::OnUnmounted() noexcept {
89
129
  m_layoutMetricChangedRevokers.clear();
90
130
  if (m_navigationHostDepartFocusRequestedToken && m_navigationHost) {
91
131
  m_navigationHost.DepartFocusRequested(m_navigationHostDepartFocusRequestedToken);
92
132
  m_navigationHostDepartFocusRequestedToken = {};
93
133
  }
134
+ UnregisterForRootIslandEvents();
94
135
  }
95
136
 
96
137
  void ContentIslandComponentView::ParentLayoutChanged() noexcept {
@@ -58,9 +58,16 @@ struct ContentIslandComponentView : ContentIslandComponentViewT<ContentIslandCom
58
58
  void OnMounted() noexcept;
59
59
  void OnUnmounted() noexcept;
60
60
  void ParentLayoutChanged() noexcept;
61
+ void ConnectInternal() noexcept;
62
+ void RegisterForRootIslandEvents() noexcept;
63
+ void UnregisterForRootIslandEvents() noexcept;
64
+ winrt::Microsoft::UI::Content::ContentIsland ParentContentIsland() noexcept;
61
65
 
62
66
  bool m_layoutChangePosted{false};
67
+ winrt::Microsoft::UI::Content::ContentIsland m_parentContentIsland{nullptr};
63
68
  winrt::Microsoft::UI::Content::ContentIsland m_islandToConnect{nullptr};
69
+ winrt::event_token m_islandStateChangedToken;
70
+
64
71
  winrt::event_token m_mountedToken;
65
72
  winrt::event_token m_unmountedToken;
66
73
  std::vector<winrt::Microsoft::ReactNative::ComponentView::LayoutMetricsChanged_revoker> m_layoutMetricChangedRevokers;
@@ -167,6 +167,26 @@ void ParagraphComponentView::updateTextAlignment(
167
167
  m_textLayout = nullptr;
168
168
  }
169
169
 
170
+ facebook::react::Tag ParagraphComponentView::hitTest(
171
+ facebook::react::Point pt,
172
+ facebook::react::Point &localPt,
173
+ bool ignorePointerEvents) const noexcept {
174
+ facebook::react::Point ptLocal{pt.x - m_layoutMetrics.frame.origin.x, pt.y - m_layoutMetrics.frame.origin.y};
175
+ const auto &props = paragraphProps();
176
+ const auto &vProps = *viewProps();
177
+
178
+ if (props.isSelectable && ptLocal.x >= 0 && ptLocal.x <= m_layoutMetrics.frame.size.width && ptLocal.y >= 0 &&
179
+ ptLocal.y <= m_layoutMetrics.frame.size.height) {
180
+ // claims if pointer events are enabled for this component
181
+ if (ignorePointerEvents || vProps.pointerEvents == facebook::react::PointerEventsMode::Auto ||
182
+ vProps.pointerEvents == facebook::react::PointerEventsMode::BoxOnly) {
183
+ localPt = ptLocal;
184
+ return Tag();
185
+ }
186
+ }
187
+ return Super::hitTest(pt, localPt, ignorePointerEvents);
188
+ }
189
+
170
190
  bool ParagraphComponentView::IsTextSelectableAtPoint(facebook::react::Point pt) noexcept {
171
191
  // paragraph-level selectable prop is enabled
172
192
  const auto &props = paragraphProps();
@@ -519,6 +539,7 @@ void ParagraphComponentView::ClearSelection() noexcept {
519
539
  m_selectionStart = std::nullopt;
520
540
  m_selectionEnd = std::nullopt;
521
541
  m_isSelecting = false;
542
+ m_isWordSelecting = false;
522
543
  if (hadSelection) {
523
544
  // Clears selection highlight
524
545
  DrawText();
@@ -534,7 +555,8 @@ void ParagraphComponentView::OnPointerPressed(
534
555
  return;
535
556
  }
536
557
 
537
- auto pp = args.GetCurrentPoint(-1);
558
+ // Use Tag() to get coordinates in component's local space
559
+ auto pp = args.GetCurrentPoint(static_cast<int32_t>(Tag()));
538
560
 
539
561
  // Ignores right-click
540
562
  if (pp.Properties().PointerUpdateKind() ==
@@ -545,8 +567,8 @@ void ParagraphComponentView::OnPointerPressed(
545
567
 
546
568
  auto position = pp.Position();
547
569
 
548
- facebook::react::Point localPt{
549
- position.X - m_layoutMetrics.frame.origin.x, position.Y - m_layoutMetrics.frame.origin.y};
570
+ // GetCurrentPoint(Tag()) returns position relative to component origin
571
+ facebook::react::Point localPt{position.X, position.Y};
550
572
 
551
573
  std::optional<int32_t> charPosition = GetTextPositionAtPoint(localPt);
552
574
 
@@ -568,7 +590,13 @@ void ParagraphComponentView::OnPointerPressed(
568
590
 
569
591
  if (isDoubleClick) {
570
592
  SelectWordAtPosition(*charPosition);
571
- m_isSelecting = false;
593
+ if (m_selectionStart && m_selectionEnd) {
594
+ m_isWordSelecting = true;
595
+ m_wordAnchorStart = *m_selectionStart;
596
+ m_wordAnchorEnd = *m_selectionEnd;
597
+ m_isSelecting = true;
598
+ CapturePointer(args.Pointer());
599
+ }
572
600
  } else {
573
601
  // Single-click: start drag selection
574
602
  m_selectionStart = charPosition;
@@ -610,17 +638,35 @@ void ParagraphComponentView::OnPointerMoved(
610
638
  facebook::react::Point localPt{position.X, position.Y};
611
639
  std::optional<int32_t> charPosition = GetClampedTextPosition(localPt);
612
640
 
613
- if (charPosition && charPosition != m_selectionEnd) {
614
- m_selectionEnd = charPosition;
615
- DrawText();
616
- args.Handled(true);
641
+ if (charPosition) {
642
+ if (m_isWordSelecting) {
643
+ // Extend selection by whole words
644
+ auto [wordStart, wordEnd] = GetWordBoundariesAtPosition(*charPosition);
645
+
646
+ if (*charPosition < m_wordAnchorStart) {
647
+ m_selectionStart = wordStart;
648
+ m_selectionEnd = m_wordAnchorEnd;
649
+ } else if (*charPosition >= m_wordAnchorEnd) {
650
+ m_selectionStart = m_wordAnchorStart;
651
+ m_selectionEnd = wordEnd;
652
+ } else {
653
+ m_selectionStart = m_wordAnchorStart;
654
+ m_selectionEnd = m_wordAnchorEnd;
655
+ }
656
+ DrawText();
657
+ args.Handled(true);
658
+ } else if (charPosition != m_selectionEnd) {
659
+ m_selectionEnd = charPosition;
660
+ DrawText();
661
+ args.Handled(true);
662
+ }
617
663
  }
618
664
  }
619
665
 
620
666
  void ParagraphComponentView::OnPointerReleased(
621
667
  const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept {
622
668
  // Check for right-click to show context menu
623
- auto pp = args.GetCurrentPoint(-1);
669
+ auto pp = args.GetCurrentPoint(static_cast<int32_t>(Tag()));
624
670
  if (pp.Properties().PointerUpdateKind() ==
625
671
  winrt::Microsoft::ReactNative::Composition::Input::PointerUpdateKind::RightButtonReleased) {
626
672
  const auto &props = paragraphProps();
@@ -637,6 +683,7 @@ void ParagraphComponentView::OnPointerReleased(
637
683
  }
638
684
 
639
685
  m_isSelecting = false;
686
+ m_isWordSelecting = false;
640
687
 
641
688
  ReleasePointerCapture(args.Pointer());
642
689
 
@@ -661,6 +708,7 @@ void ParagraphComponentView::OnPointerCaptureLost() noexcept {
661
708
  // Pointer capture was lost stop any active selection drag
662
709
  if (m_isSelecting) {
663
710
  m_isSelecting = false;
711
+ m_isWordSelecting = false;
664
712
 
665
713
  if (!m_selectionStart || !m_selectionEnd || *m_selectionStart == *m_selectionEnd) {
666
714
  m_selectionStart = std::nullopt;
@@ -711,12 +759,17 @@ void ParagraphComponentView::CopySelectionToClipboard() noexcept {
711
759
  winrt::Windows::ApplicationModel::DataTransfer::Clipboard::SetContent(dataPackage);
712
760
  }
713
761
 
714
- void ParagraphComponentView::SelectWordAtPosition(int32_t charPosition) noexcept {
762
+ std::pair<int32_t, int32_t> ParagraphComponentView::GetWordBoundariesAtPosition(int32_t charPosition) noexcept {
715
763
  const std::wstring utf16Text{facebook::react::WindowsTextLayoutManager::GetTransformedText(m_attributedStringBox)};
716
764
  const int32_t textLength = static_cast<int32_t>(utf16Text.length());
717
765
 
718
- if (utf16Text.empty() || charPosition < 0 || charPosition >= textLength) {
719
- return;
766
+ if (utf16Text.empty() || charPosition < 0) {
767
+ return {0, 0};
768
+ }
769
+
770
+ charPosition = std::min(charPosition, textLength - 1);
771
+ if (charPosition < 0) {
772
+ return {0, 0};
720
773
  }
721
774
 
722
775
  int32_t wordStart = charPosition;
@@ -749,6 +802,12 @@ void ParagraphComponentView::SelectWordAtPosition(int32_t charPosition) noexcept
749
802
  }
750
803
  }
751
804
 
805
+ return {wordStart, wordEnd};
806
+ }
807
+
808
+ void ParagraphComponentView::SelectWordAtPosition(int32_t charPosition) noexcept {
809
+ auto [wordStart, wordEnd] = GetWordBoundariesAtPosition(charPosition);
810
+
752
811
  if (wordEnd > wordStart) {
753
812
  SetSelection(wordStart, wordEnd);
754
813
  DrawText();
@@ -49,6 +49,11 @@ struct ParagraphComponentView : ParagraphComponentViewT<ParagraphComponentView,
49
49
  static facebook::react::SharedViewProps defaultProps() noexcept;
50
50
  const facebook::react::ParagraphProps &paragraphProps() const noexcept;
51
51
 
52
+ facebook::react::Tag hitTest(
53
+ facebook::react::Point pt,
54
+ facebook::react::Point &localPt,
55
+ bool ignorePointerEvents = false) const noexcept override;
56
+
52
57
  // Returns true when text is selectable
53
58
  bool focusable() const noexcept override;
54
59
 
@@ -95,6 +100,7 @@ struct ParagraphComponentView : ParagraphComponentViewT<ParagraphComponentView,
95
100
 
96
101
  // Selects the word at the given character position
97
102
  void SelectWordAtPosition(int32_t charPosition) noexcept;
103
+ std::pair<int32_t, int32_t> GetWordBoundariesAtPosition(int32_t charPosition) noexcept;
98
104
 
99
105
  // Shows a context menu with Copy/Select All options on right-click
100
106
  void ShowContextMenu() noexcept;
@@ -113,6 +119,11 @@ struct ParagraphComponentView : ParagraphComponentViewT<ParagraphComponentView,
113
119
  std::optional<int32_t> m_selectionEnd;
114
120
  bool m_isSelecting{false};
115
121
 
122
+ // Double click + drag selection
123
+ bool m_isWordSelecting{false};
124
+ int32_t m_wordAnchorStart{0};
125
+ int32_t m_wordAnchorEnd{0};
126
+
116
127
  // Double-click detection
117
128
  std::chrono::steady_clock::time_point m_lastClickTime{};
118
129
  std::optional<int32_t> m_lastClickPosition;
@@ -48,7 +48,8 @@ HRESULT UiaNavigateHelper(
48
48
  uint32_t index = children.Size() - 1;
49
49
  do {
50
50
  auto child = children.GetAt(index).as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
51
- if (uiaProvider = child->EnsureUiaProvider()) {
51
+ uiaProvider = child->EnsureUiaProvider();
52
+ if (uiaProvider) {
52
53
  break;
53
54
  }
54
55
  } while (index-- != 0);
@@ -60,7 +61,8 @@ HRESULT UiaNavigateHelper(
60
61
  uint32_t index = 0;
61
62
  do {
62
63
  auto child = children.GetAt(index).as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
63
- if (uiaProvider = child->EnsureUiaProvider()) {
64
+ uiaProvider = child->EnsureUiaProvider();
65
+ if (uiaProvider) {
64
66
  break;
65
67
  }
66
68
  } while (++index != children.Size());
@@ -74,7 +76,8 @@ HRESULT UiaNavigateHelper(
74
76
 
75
77
  while (++it != children.end()) {
76
78
  auto nextchild = (*it).as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
77
- if (uiaProvider = nextchild->EnsureUiaProvider()) {
79
+ uiaProvider = nextchild->EnsureUiaProvider();
80
+ if (uiaProvider) {
78
81
  break;
79
82
  }
80
83
  }
@@ -91,7 +94,8 @@ HRESULT UiaNavigateHelper(
91
94
  do {
92
95
  it--;
93
96
  auto prevchild = (*it).as<winrt::Microsoft::ReactNative::implementation::ComponentView>();
94
- if (uiaProvider = prevchild->EnsureUiaProvider()) {
97
+ uiaProvider = prevchild->EnsureUiaProvider();
98
+ if (uiaProvider) {
95
99
  break;
96
100
  }
97
101
  } while (it != children.begin());
@@ -30,20 +30,33 @@ using namespace xaml::Media::Imaging;
30
30
 
31
31
  namespace Microsoft::ReactNative {
32
32
 
33
+ static const char *ERROR_INVALID_URI = "E_INVALID_URI";
34
+ static const char *ERROR_GET_SIZE_FAILURE = "E_GET_SIZE_FAILURE";
35
+
33
36
  winrt::fire_and_forget GetImageSizeAsync(
34
37
  const winrt::Microsoft::ReactNative::IReactPropertyBag &properties,
35
38
  std::string uriString,
36
39
  winrt::Microsoft::ReactNative::JSValue &&headers,
37
40
  Mso::Functor<void(int32_t width, int32_t height)> successCallback,
38
- Mso::Functor<void()> errorCallback
41
+ Mso::Functor<void(const char *errorCode, std::string errorMessage)> errorCallback
39
42
  #ifdef USE_FABRIC
40
43
  ,
41
44
  bool useFabric
42
45
  #endif // USE_FABRIC
43
46
  ) {
44
47
  bool succeeded{false};
48
+ const char *errorCode = ERROR_GET_SIZE_FAILURE;
49
+ std::string errorMessage;
45
50
 
46
51
  try {
52
+ // Validate URI is not empty
53
+ if (uriString.empty()) {
54
+ errorCode = ERROR_INVALID_URI;
55
+ errorMessage = "Cannot get the size of an image for an empty URI";
56
+ errorCallback(errorCode, errorMessage);
57
+ co_return;
58
+ }
59
+
47
60
  ReactImageSource source;
48
61
  source.uri = uriString;
49
62
  if (!headers.IsNull()) {
@@ -56,9 +69,10 @@ winrt::fire_and_forget GetImageSizeAsync(
56
69
  winrt::hstring scheme{uri.SchemeName()};
57
70
  bool needsDownload = (scheme == L"http") || (scheme == L"https");
58
71
  bool inlineData = scheme == L"data";
72
+ bool isLocalFile = (scheme == L"file") || (scheme == L"ms-appx") || (scheme == L"ms-appdata");
59
73
 
60
74
  winrt::IRandomAccessStream memoryStream;
61
- if (needsDownload) {
75
+ if (needsDownload || isLocalFile) {
62
76
  memoryStream = co_await GetImageStreamAsync(properties, source);
63
77
  } else if (inlineData) {
64
78
  memoryStream = co_await GetImageInlineDataAsync(source);
@@ -77,23 +91,31 @@ winrt::fire_and_forget GetImageSizeAsync(
77
91
  }
78
92
  #ifdef USE_FABRIC
79
93
  } else {
80
- auto result = wicBitmapSourceFromStream(memoryStream);
81
- if (!std::get<std::shared_ptr<facebook::react::ImageErrorInfo>>(result)) {
82
- auto imagingFactory = std::get<winrt::com_ptr<IWICImagingFactory>>(result);
83
- auto wicBmpSource = std::get<winrt::com_ptr<IWICBitmapSource>>(result);
84
- UINT width, height;
85
- if (SUCCEEDED(wicBmpSource->GetSize(&width, &height))) {
86
- successCallback(width, height);
87
- succeeded = true;
94
+ if (memoryStream) { // Added nullcheck to prevent app from crashing if value is uninitialized
95
+ auto result = wicBitmapSourceFromStream(memoryStream);
96
+ if (!std::get<std::shared_ptr<facebook::react::ImageErrorInfo>>(result)) {
97
+ auto imagingFactory = std::get<winrt::com_ptr<IWICImagingFactory>>(result);
98
+ auto wicBmpSource = std::get<winrt::com_ptr<IWICBitmapSource>>(result);
99
+ UINT width, height;
100
+ if (SUCCEEDED(wicBmpSource->GetSize(&width, &height))) {
101
+ successCallback(width, height);
102
+ succeeded = true;
103
+ }
88
104
  }
89
105
  }
90
106
  }
91
107
  #endif // USE_FABRIC
92
- } catch (winrt::hresult_error const &) {
108
+ } catch (winrt::hresult_error const &e) {
109
+ errorMessage = "Failed to get image size: " + Microsoft::Common::Unicode::Utf16ToUtf8(std::wstring(e.message())) +
110
+ " for URI: " + uriString;
93
111
  }
94
112
 
95
- if (!succeeded)
96
- errorCallback();
113
+ if (!succeeded) {
114
+ if (errorMessage.empty()) {
115
+ errorMessage = "Failed to get image size for URI: " + uriString;
116
+ }
117
+ errorCallback(errorCode, errorMessage);
118
+ }
97
119
 
98
120
  co_return;
99
121
  }
@@ -112,7 +134,9 @@ void ImageLoader::getSize(std::string uri, React::ReactPromise<std::vector<doubl
112
134
  [result](double width, double height) noexcept {
113
135
  result.Resolve(std::vector<double>{width, height});
114
136
  },
115
- [result]() noexcept { result.Reject("Failed"); }
137
+ [result](const char *errorCode, std::string errorMessage) noexcept {
138
+ result.Reject(React::ReactError{errorCode, errorMessage});
139
+ }
116
140
  #ifdef USE_FABRIC
117
141
  ,
118
142
  IsFabricEnabled(context.Properties().Handle())
@@ -137,7 +161,9 @@ void ImageLoader::getSizeWithHeaders(
137
161
  [result](double width, double height) noexcept {
138
162
  result.Resolve(Microsoft::ReactNativeSpecs::ImageLoaderIOSSpec_getSizeWithHeaders_returnType{width, height});
139
163
  },
140
- [result]() noexcept { result.Reject("Failed"); }
164
+ [result](const char *errorCode, std::string errorMessage) noexcept {
165
+ result.Reject(React::ReactError{errorCode, errorMessage});
166
+ }
141
167
  #ifdef USE_FABRIC
142
168
  ,
143
169
  IsFabricEnabled(context.Properties().Handle())
@@ -205,8 +205,10 @@ void QueueService::InvokeTask(
205
205
  DispatchTask taskToInvoke{std::move(task)};
206
206
  taskToInvoke.Get()->Invoke(); // Call Get()->Invoke instead of operator() to flatten call stack
207
207
 
208
- while (taskToInvoke = context.TakeNextDeferredTask()) {
208
+ taskToInvoke = context.TakeNextDeferredTask();
209
+ while (taskToInvoke) {
209
210
  taskToInvoke.Get()->Invoke();
211
+ taskToInvoke = context.TakeNextDeferredTask();
210
212
  }
211
213
  }
212
214
 
@@ -271,7 +271,8 @@ bool UISchedulerWinRT<TDispatcherTraits>::TryTakeTask(
271
271
  --m_taskCount;
272
272
  }
273
273
 
274
- if (queue = m_queue.GetStrongPtr()) {
274
+ queue = m_queue.GetStrongPtr();
275
+ if (queue) {
275
276
  return queue->TryDequeTask(task);
276
277
  }
277
278
 
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.81.3</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.81.4</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>81</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>3</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>4</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>2c35b82f34d7821ca3d855c0bb51fb44d4d8c1df</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>6cfb66be9b4dbbdff53e896e215230cdeddc38a6</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -758,7 +758,8 @@ ResponseOperation OriginPolicyHttpFilter::SendRequestAsync(HttpRequestMessage co
758
758
  if (originPolicy == OriginPolicy::CrossOriginResourceSharing) {
759
759
  // If inner filter can AllowRedirect, disable for preflight.
760
760
  winrt::impl::com_ref<IHttpBaseProtocolFilter> baseFilter;
761
- if (baseFilter = m_innerFilter.try_as<IHttpBaseProtocolFilter>()) {
761
+ baseFilter = m_innerFilter.try_as<IHttpBaseProtocolFilter>();
762
+ if (baseFilter) {
762
763
  baseFilter.AllowAutoRedirect(false);
763
764
  }
764
765
 
@@ -59,55 +59,55 @@ struct AndroidDrawerLayoutProps : winrt::implements<AndroidDrawerLayoutProps, wi
59
59
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
60
60
  };
61
61
 
62
- REACT_STRUCT(AndroidDrawerLayout_OnDrawerSlide)
63
- struct AndroidDrawerLayout_OnDrawerSlide {
64
- REACT_FIELD(offset)
65
- float offset{};
62
+ REACT_STRUCT(AndroidDrawerLayoutSpec_onDrawerClose)
63
+ struct AndroidDrawerLayoutSpec_onDrawerClose {
66
64
  };
67
65
 
68
- REACT_STRUCT(AndroidDrawerLayout_OnDrawerStateChanged)
69
- struct AndroidDrawerLayout_OnDrawerStateChanged {
70
- REACT_FIELD(drawerState)
71
- int32_t drawerState{};
66
+ REACT_STRUCT(AndroidDrawerLayoutSpec_onDrawerOpen)
67
+ struct AndroidDrawerLayoutSpec_onDrawerOpen {
72
68
  };
73
69
 
74
- REACT_STRUCT(AndroidDrawerLayout_OnDrawerOpen)
75
- struct AndroidDrawerLayout_OnDrawerOpen {
70
+ REACT_STRUCT(AndroidDrawerLayoutSpec_onDrawerStateChanged)
71
+ struct AndroidDrawerLayoutSpec_onDrawerStateChanged {
72
+ REACT_FIELD(drawerState)
73
+ int32_t drawerState{};
76
74
  };
77
75
 
78
- REACT_STRUCT(AndroidDrawerLayout_OnDrawerClose)
79
- struct AndroidDrawerLayout_OnDrawerClose {
76
+ REACT_STRUCT(AndroidDrawerLayoutSpec_onDrawerSlide)
77
+ struct AndroidDrawerLayoutSpec_onDrawerSlide {
78
+ REACT_FIELD(offset)
79
+ float offset{};
80
80
  };
81
81
 
82
82
  struct AndroidDrawerLayoutEventEmitter {
83
83
  AndroidDrawerLayoutEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
84
84
  : m_eventEmitter(eventEmitter) {}
85
85
 
86
- using OnDrawerSlide = AndroidDrawerLayout_OnDrawerSlide;
87
- using OnDrawerStateChanged = AndroidDrawerLayout_OnDrawerStateChanged;
88
- using OnDrawerOpen = AndroidDrawerLayout_OnDrawerOpen;
89
- using OnDrawerClose = AndroidDrawerLayout_OnDrawerClose;
86
+ using OnDrawerSlide = AndroidDrawerLayoutSpec_onDrawerSlide;
87
+ using OnDrawerStateChanged = AndroidDrawerLayoutSpec_onDrawerStateChanged;
88
+ using OnDrawerOpen = AndroidDrawerLayoutSpec_onDrawerOpen;
89
+ using OnDrawerClose = AndroidDrawerLayoutSpec_onDrawerClose;
90
90
 
91
91
  void onDrawerSlide(OnDrawerSlide &value) const {
92
- m_eventEmitter.DispatchEvent(L"drawerSlide", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
92
+ m_eventEmitter.DispatchEvent(L"drawerSlide", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
93
93
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
94
94
  });
95
95
  }
96
96
 
97
97
  void onDrawerStateChanged(OnDrawerStateChanged &value) const {
98
- m_eventEmitter.DispatchEvent(L"drawerStateChanged", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
98
+ m_eventEmitter.DispatchEvent(L"drawerStateChanged", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
99
99
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
100
100
  });
101
101
  }
102
102
 
103
103
  void onDrawerOpen(OnDrawerOpen &value) const {
104
- m_eventEmitter.DispatchEvent(L"drawerOpen", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
104
+ m_eventEmitter.DispatchEvent(L"drawerOpen", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
105
105
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
106
106
  });
107
107
  }
108
108
 
109
109
  void onDrawerClose(OnDrawerClose &value) const {
110
- m_eventEmitter.DispatchEvent(L"drawerClose", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
110
+ m_eventEmitter.DispatchEvent(L"drawerClose", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
111
111
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
112
112
  });
113
113
  }
@@ -59,18 +59,18 @@ struct AndroidSwipeRefreshLayoutProps : winrt::implements<AndroidSwipeRefreshLay
59
59
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
60
60
  };
61
61
 
62
- REACT_STRUCT(AndroidSwipeRefreshLayout_OnRefresh)
63
- struct AndroidSwipeRefreshLayout_OnRefresh {
62
+ REACT_STRUCT(AndroidSwipeRefreshLayoutSpec_onRefresh)
63
+ struct AndroidSwipeRefreshLayoutSpec_onRefresh {
64
64
  };
65
65
 
66
66
  struct AndroidSwipeRefreshLayoutEventEmitter {
67
67
  AndroidSwipeRefreshLayoutEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
68
68
  : m_eventEmitter(eventEmitter) {}
69
69
 
70
- using OnRefresh = AndroidSwipeRefreshLayout_OnRefresh;
70
+ using OnRefresh = AndroidSwipeRefreshLayoutSpec_onRefresh;
71
71
 
72
72
  void onRefresh(OnRefresh &value) const {
73
- m_eventEmitter.DispatchEvent(L"refresh", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
73
+ m_eventEmitter.DispatchEvent(L"refresh", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
74
74
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
75
75
  });
76
76
  }
@@ -71,8 +71,8 @@ struct AndroidSwitchProps : winrt::implements<AndroidSwitchProps, winrt::Microso
71
71
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
72
72
  };
73
73
 
74
- REACT_STRUCT(AndroidSwitch_OnChange)
75
- struct AndroidSwitch_OnChange {
74
+ REACT_STRUCT(AndroidSwitchSpec_onChange)
75
+ struct AndroidSwitchSpec_onChange {
76
76
  REACT_FIELD(value)
77
77
  bool value{};
78
78
 
@@ -84,10 +84,10 @@ struct AndroidSwitchEventEmitter {
84
84
  AndroidSwitchEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
85
85
  : m_eventEmitter(eventEmitter) {}
86
86
 
87
- using OnChange = AndroidSwitch_OnChange;
87
+ using OnChange = AndroidSwitchSpec_onChange;
88
88
 
89
89
  void onChange(OnChange &value) const {
90
- m_eventEmitter.DispatchEvent(L"change", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
90
+ m_eventEmitter.DispatchEvent(L"change", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
91
91
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
92
92
  });
93
93
  }
@@ -83,53 +83,53 @@ struct ModalHostViewProps : winrt::implements<ModalHostViewProps, winrt::Microso
83
83
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
84
84
  };
85
85
 
86
- REACT_STRUCT(ModalHostView_OnRequestClose)
87
- struct ModalHostView_OnRequestClose {
86
+ REACT_STRUCT(ModalHostViewSpec_onOrientationChange)
87
+ struct ModalHostViewSpec_onOrientationChange {
88
+ REACT_FIELD(orientation)
89
+ std::string orientation;
88
90
  };
89
91
 
90
- REACT_STRUCT(ModalHostView_OnShow)
91
- struct ModalHostView_OnShow {
92
+ REACT_STRUCT(ModalHostViewSpec_onDismiss)
93
+ struct ModalHostViewSpec_onDismiss {
92
94
  };
93
95
 
94
- REACT_STRUCT(ModalHostView_OnDismiss)
95
- struct ModalHostView_OnDismiss {
96
+ REACT_STRUCT(ModalHostViewSpec_onShow)
97
+ struct ModalHostViewSpec_onShow {
96
98
  };
97
99
 
98
- REACT_STRUCT(ModalHostView_OnOrientationChange)
99
- struct ModalHostView_OnOrientationChange {
100
- REACT_FIELD(orientation)
101
- std::string orientation;
100
+ REACT_STRUCT(ModalHostViewSpec_onRequestClose)
101
+ struct ModalHostViewSpec_onRequestClose {
102
102
  };
103
103
 
104
104
  struct ModalHostViewEventEmitter {
105
105
  ModalHostViewEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
106
106
  : m_eventEmitter(eventEmitter) {}
107
107
 
108
- using OnRequestClose = ModalHostView_OnRequestClose;
109
- using OnShow = ModalHostView_OnShow;
110
- using OnDismiss = ModalHostView_OnDismiss;
111
- using OnOrientationChange = ModalHostView_OnOrientationChange;
108
+ using OnRequestClose = ModalHostViewSpec_onRequestClose;
109
+ using OnShow = ModalHostViewSpec_onShow;
110
+ using OnDismiss = ModalHostViewSpec_onDismiss;
111
+ using OnOrientationChange = ModalHostViewSpec_onOrientationChange;
112
112
 
113
113
  void onRequestClose(OnRequestClose &value) const {
114
- m_eventEmitter.DispatchEvent(L"requestClose", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
114
+ m_eventEmitter.DispatchEvent(L"requestClose", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
115
115
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
116
116
  });
117
117
  }
118
118
 
119
119
  void onShow(OnShow &value) const {
120
- m_eventEmitter.DispatchEvent(L"show", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
120
+ m_eventEmitter.DispatchEvent(L"show", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
121
121
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
122
122
  });
123
123
  }
124
124
 
125
125
  void onDismiss(OnDismiss &value) const {
126
- m_eventEmitter.DispatchEvent(L"dismiss", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
126
+ m_eventEmitter.DispatchEvent(L"dismiss", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
127
127
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
128
128
  });
129
129
  }
130
130
 
131
131
  void onOrientationChange(OnOrientationChange &value) const {
132
- m_eventEmitter.DispatchEvent(L"orientationChange", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
132
+ m_eventEmitter.DispatchEvent(L"orientationChange", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
133
133
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
134
134
  });
135
135
  }
@@ -55,18 +55,18 @@ struct PullToRefreshViewProps : winrt::implements<PullToRefreshViewProps, winrt:
55
55
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
56
56
  };
57
57
 
58
- REACT_STRUCT(PullToRefreshView_OnRefresh)
59
- struct PullToRefreshView_OnRefresh {
58
+ REACT_STRUCT(PullToRefreshViewSpec_onRefresh)
59
+ struct PullToRefreshViewSpec_onRefresh {
60
60
  };
61
61
 
62
62
  struct PullToRefreshViewEventEmitter {
63
63
  PullToRefreshViewEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
64
64
  : m_eventEmitter(eventEmitter) {}
65
65
 
66
- using OnRefresh = PullToRefreshView_OnRefresh;
66
+ using OnRefresh = PullToRefreshViewSpec_onRefresh;
67
67
 
68
68
  void onRefresh(OnRefresh &value) const {
69
- m_eventEmitter.DispatchEvent(L"refresh", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
69
+ m_eventEmitter.DispatchEvent(L"refresh", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
70
70
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
71
71
  });
72
72
  }
@@ -67,8 +67,8 @@ struct SwitchProps : winrt::implements<SwitchProps, winrt::Microsoft::ReactNativ
67
67
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
68
68
  };
69
69
 
70
- REACT_STRUCT(Switch_OnChange)
71
- struct Switch_OnChange {
70
+ REACT_STRUCT(SwitchSpec_onChange)
71
+ struct SwitchSpec_onChange {
72
72
  REACT_FIELD(value)
73
73
  bool value{};
74
74
 
@@ -80,10 +80,10 @@ struct SwitchEventEmitter {
80
80
  SwitchEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
81
81
  : m_eventEmitter(eventEmitter) {}
82
82
 
83
- using OnChange = Switch_OnChange;
83
+ using OnChange = SwitchSpec_onChange;
84
84
 
85
85
  void onChange(OnChange &value) const {
86
- m_eventEmitter.DispatchEvent(L"change", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
86
+ m_eventEmitter.DispatchEvent(L"change", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
87
87
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
88
88
  });
89
89
  }
@@ -43,8 +43,38 @@ struct VirtualViewProps : winrt::implements<VirtualViewProps, winrt::Microsoft::
43
43
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
44
44
  };
45
45
 
46
- REACT_STRUCT(VirtualView_OnModeChange)
47
- struct VirtualView_OnModeChange {
46
+ REACT_STRUCT(VirtualViewSpec_onModeChange3)
47
+ struct VirtualViewSpec_onModeChange3 {
48
+ REACT_FIELD(x)
49
+ double x{};
50
+
51
+ REACT_FIELD(y)
52
+ double y{};
53
+
54
+ REACT_FIELD(width)
55
+ double width{};
56
+
57
+ REACT_FIELD(height)
58
+ double height{};
59
+ };
60
+
61
+ REACT_STRUCT(VirtualViewSpec_onModeChange2)
62
+ struct VirtualViewSpec_onModeChange2 {
63
+ REACT_FIELD(x)
64
+ double x{};
65
+
66
+ REACT_FIELD(y)
67
+ double y{};
68
+
69
+ REACT_FIELD(width)
70
+ double width{};
71
+
72
+ REACT_FIELD(height)
73
+ double height{};
74
+ };
75
+
76
+ REACT_STRUCT(VirtualViewSpec_onModeChange)
77
+ struct VirtualViewSpec_onModeChange {
48
78
  REACT_FIELD(mode)
49
79
  int32_t mode{};
50
80
 
@@ -59,12 +89,10 @@ struct VirtualViewEventEmitter {
59
89
  VirtualViewEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
60
90
  : m_eventEmitter(eventEmitter) {}
61
91
 
62
- using OnModeChange = VirtualView_OnModeChange;
63
- using OnModeChange2 = VirtualView_OnModeChange2;
64
- using OnModeChange3 = VirtualView_OnModeChange3;
92
+ using OnModeChange = VirtualViewSpec_onModeChange;
65
93
 
66
94
  void onModeChange(OnModeChange &value) const {
67
- m_eventEmitter.DispatchEvent(L"modeChange", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
95
+ m_eventEmitter.DispatchEvent(L"modeChange", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
68
96
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
69
97
  });
70
98
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.81.3",
3
+ "version": "0.81.4",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "@react-native-community/cli": "17.0.0",
27
27
  "@react-native-community/cli-platform-android": "17.0.0",
28
28
  "@react-native-community/cli-platform-ios": "17.0.0",
29
- "@react-native-windows/cli": "0.81.1",
29
+ "@react-native-windows/cli": "0.81.2",
30
30
  "@react-native/assets": "1.0.0",
31
31
  "@react-native/assets-registry": "0.81.5",
32
32
  "@react-native/codegen": "0.81.5",
@@ -68,7 +68,7 @@
68
68
  "yargs": "^17.6.2"
69
69
  },
70
70
  "devDependencies": {
71
- "@react-native-windows/codegen": "0.81.1",
71
+ "@react-native-windows/codegen": "0.81.2",
72
72
  "@react-native/metro-config": "0.81.5",
73
73
  "@rnw-scripts/babel-react-native-config": "0.0.0",
74
74
  "@rnw-scripts/eslint-config": "1.2.37",