react-native-windows 0.77.6 → 0.77.8

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/Directory.Build.props +2 -2
  2. package/Folly/TEMP_UntilFollyUpdate/json.cpp +4 -0
  3. package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.cpp +23 -15
  4. package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.h +5 -5
  5. package/Folly/cgmanifest.json +1 -1
  6. package/Libraries/Modal/Modal.windows.js +4 -1
  7. package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
  8. package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.cpp +97 -0
  9. package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.h +53 -0
  10. package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.h +160 -17
  11. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +0 -1
  12. package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
  13. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +0 -2
  14. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +13 -32
  15. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -3
  16. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +1 -1
  17. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
  18. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +25 -20
  19. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +313 -319
  20. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
  21. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +78 -0
  22. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
  23. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +22 -0
  24. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -5
  25. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +79 -19
  26. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
  27. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +73 -19
  28. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +16 -0
  29. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +2 -2
  30. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +38 -23
  31. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +1 -6
  32. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
  33. package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
  34. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +15 -1
  35. package/Microsoft.ReactNative/ReactNativeHost.cpp +5 -0
  36. package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
  37. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  38. package/Shared/Networking/WinRTWebSocketResource.cpp +5 -0
  39. package/Shared/Shared.vcxitems +6 -5
  40. package/Shared/Shared.vcxitems.filters +3 -4
  41. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
  42. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
  43. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
  44. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
  45. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
  46. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
  47. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
  48. package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
  49. package/codegen/react/components/rnwcore/ModalHostView.g.h +283 -0
  50. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
  51. package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
  52. package/codegen/react/components/rnwcore/Switch.g.h +263 -0
  53. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
  54. package/just-task.js +1 -1
  55. package/package.json +6 -6
  56. package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +0 -191
  57. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
  58. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
  59. 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,6 +76,7 @@ void RootComponentView::updateLayoutMetrics(
61
76
  winrt::Microsoft::ReactNative::ComponentView RootComponentView::GetFocusedComponent() noexcept {
62
77
  return m_focusedComponent;
63
78
  }
79
+
64
80
  void RootComponentView::SetFocusedComponent(const winrt::Microsoft::ReactNative::ComponentView &value) noexcept {
65
81
  if (m_focusedComponent == value)
66
82
  return;
@@ -75,22 +91,21 @@ void RootComponentView::SetFocusedComponent(const winrt::Microsoft::ReactNative:
75
91
  if (auto rootView = m_wkRootView.get()) {
76
92
  winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(rootView)->TrySetFocus();
77
93
  }
94
+ m_focusedComponent = value;
78
95
  auto args = winrt::make<winrt::Microsoft::ReactNative::implementation::GotFocusEventArgs>(value);
79
96
  winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(value)->onGotFocus(args);
80
97
  }
81
-
82
- m_focusedComponent = value;
83
98
  }
84
99
 
85
100
  bool RootComponentView::NavigateFocus(const winrt::Microsoft::ReactNative::FocusNavigationRequest &request) noexcept {
86
101
  if (request.Reason() == winrt::Microsoft::ReactNative::FocusNavigationReason::Restore) {
87
- // No-op for now
88
- return m_focusedComponent != nullptr;
102
+ if (m_focusedComponent)
103
+ return true;
89
104
  }
90
105
 
91
- auto view = (request.Reason() == winrt::Microsoft::ReactNative::FocusNavigationReason::First)
92
- ? FocusManager::FindFirstFocusableElement(*this)
93
- : FocusManager::FindLastFocusableElement(*this);
106
+ auto view = (request.Reason() == winrt::Microsoft::ReactNative::FocusNavigationReason::Last)
107
+ ? FocusManager::FindLastFocusableElement(*this)
108
+ : FocusManager::FindFirstFocusableElement(*this);
94
109
  if (view) {
95
110
  TrySetFocusedComponent(
96
111
  view,
@@ -116,8 +131,10 @@ bool RootComponentView::TrySetFocusedComponent(
116
131
  selfView = winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(target);
117
132
  }
118
133
 
119
- if (selfView && selfView->rootComponentView() != this)
134
+ if (selfView && selfView->rootComponentView() != this) {
135
+ assert(false);
120
136
  return false;
137
+ }
121
138
 
122
139
  auto losingFocusArgs = winrt::make<winrt::Microsoft::ReactNative::implementation::LosingFocusEventArgs>(
123
140
  target, direction, m_focusedComponent, target);
@@ -197,7 +214,7 @@ HRESULT RootComponentView::GetFragmentRoot(IRawElementProviderFragmentRoot **pRe
197
214
  if (uiManager == nullptr)
198
215
  return UIA_E_ELEMENTNOTAVAILABLE;
199
216
 
200
- auto rootView{uiManager->GetReactNativeIsland(Tag())};
217
+ auto rootView = m_wkRootView.get();
201
218
  if (!rootView) {
202
219
  return UIA_E_ELEMENTNOTAVAILABLE;
203
220
  }
@@ -214,10 +231,43 @@ uint32_t RootComponentView::overlayIndex() noexcept {
214
231
  return 1;
215
232
  }
216
233
 
217
- void RootComponentView::start(const winrt::Microsoft::ReactNative::ReactNativeIsland &rootView) noexcept {
218
- winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(rootView)->AddRenderedVisual(
234
+ void RootComponentView::start(const winrt::Microsoft::ReactNative::ReactNativeIsland &island) noexcept {
235
+ theme(winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::Theme>(island.Theme()));
236
+
237
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(island)->AddRenderedVisual(
219
238
  OuterVisual());
220
- m_wkRootView = rootView;
239
+ m_visualAddedToIsland = true;
240
+ ReactNativeIsland(island);
241
+ }
242
+
243
+ void RootComponentView::stop() noexcept {
244
+ SetFocusedComponent(nullptr);
245
+ if (m_visualAddedToIsland) {
246
+ if (auto rootView = m_wkRootView.get()) {
247
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(rootView)->RemoveRenderedVisual(
248
+ OuterVisual());
249
+ }
250
+ m_visualAddedToIsland = false;
251
+ }
252
+ // Disconnect from the Island. In case of an instance reload, the island may now
253
+ // be attached to a new RootComponentView, so we should stop interacting with it.
254
+ ReactNativeIsland(nullptr);
255
+ }
256
+
257
+ void RootComponentView::ReactNativeIsland(const winrt::Microsoft::ReactNative::ReactNativeIsland &island) noexcept {
258
+ m_wkRootView = island;
259
+ }
260
+
261
+ winrt::Microsoft::ReactNative::ReactNativeIsland RootComponentView::ReactNativeIsland() noexcept {
262
+ return m_wkRootView.get();
263
+ }
264
+
265
+ winrt::Microsoft::ReactNative::Composition::PortalComponentView RootComponentView::Portal() const noexcept {
266
+ return m_wkPortal.get();
267
+ }
268
+
269
+ facebook::react::Point RootComponentView::getClientOffset() const noexcept {
270
+ return {};
221
271
  }
222
272
 
223
273
  winrt::IInspectable RootComponentView::UiaProviderFromPoint(const POINT &ptPixels) noexcept {
@@ -226,6 +276,10 @@ winrt::IInspectable RootComponentView::UiaProviderFromPoint(const POINT &ptPixel
226
276
  static_cast<facebook::react::Float>(ptPixels.y) / m_layoutMetrics.pointScaleFactor};
227
277
 
228
278
  facebook::react::Point localPt;
279
+
280
+ // 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
281
+ // to apply the current origin
282
+ ptDips += m_layoutMetrics.frame.origin;
229
283
  auto tag = hitTest(ptDips, localPt, true);
230
284
 
231
285
  auto uiManager = ::Microsoft::ReactNative::FabricUIManager::FromProperties(m_reactContext.Properties());
@@ -46,6 +46,12 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
46
46
  // Index that visuals can be inserted into OuterVisual for debugging UI
47
47
  uint32_t overlayIndex() noexcept;
48
48
  void start(const winrt::Microsoft::ReactNative::ReactNativeIsland &rootView) noexcept;
49
+ void stop() noexcept;
50
+
51
+ void ReactNativeIsland(const winrt::Microsoft::ReactNative::ReactNativeIsland &rootView) noexcept;
52
+ winrt::Microsoft::ReactNative::ReactNativeIsland ReactNativeIsland() noexcept;
53
+
54
+ facebook::react::Point getClientOffset() const noexcept override;
49
55
 
50
56
  HRESULT GetFragmentRoot(IRawElementProviderFragmentRoot **pRetVal) noexcept;
51
57
  winrt::Microsoft::ReactNative::implementation::ClipState getClipState() noexcept override;
@@ -60,8 +66,16 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
60
66
  RootComponentView(
61
67
  const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
62
68
  facebook::react::Tag tag,
69
+ winrt::Microsoft::ReactNative::ReactContext const &reactContext,
70
+ ReactCompositionViewComponentBuilder *builder);
71
+
72
+ RootComponentView(
73
+ const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
74
+ const winrt::Microsoft::ReactNative::Composition::PortalComponentView &portal,
63
75
  winrt::Microsoft::ReactNative::ReactContext const &reactContext);
64
76
 
77
+ winrt::Microsoft::ReactNative::Composition::PortalComponentView Portal() const noexcept;
78
+
65
79
  virtual ~RootComponentView();
66
80
 
67
81
  winrt::Microsoft::ReactNative::ComponentView FindFirstFocusableElement() noexcept;
@@ -75,6 +89,8 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
75
89
  // happening.
76
90
  winrt::Microsoft::ReactNative::ComponentView m_focusedComponent{nullptr};
77
91
  winrt::weak_ref<winrt::Microsoft::ReactNative::ReactNativeIsland> m_wkRootView{nullptr};
92
+ winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::PortalComponentView> m_wkPortal{nullptr};
93
+ bool m_visualAddedToIsland{false};
78
94
  };
79
95
 
80
96
  } // namespace winrt::Microsoft::ReactNative::Composition::implementation
@@ -1147,10 +1147,10 @@ void WindowsTextInputComponentView::OnTextUpdated() noexcept {
1147
1147
  emitter->onChange(onChangeArgs);
1148
1148
  }
1149
1149
 
1150
- if (m_uiaProvider) {
1150
+ if (UiaClientsAreListening()) {
1151
1151
  auto text = GetTextFromRichEdit();
1152
1152
  winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
1153
- m_uiaProvider, UIA_ValueValuePropertyId, text, text);
1153
+ EnsureUiaProvider(), UIA_ValueValuePropertyId, text, text);
1154
1154
  }
1155
1155
  }
1156
1156
 
@@ -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;
@@ -134,7 +134,6 @@ void FabricUIManager::startSurface(
134
134
 
135
135
  auto root = rootComponentViewDescriptor.view
136
136
  .as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>();
137
- root->theme(winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::Theme>(rootView.Theme()));
138
137
  root->start(rootView);
139
138
  });
140
139
 
@@ -154,15 +153,11 @@ void FabricUIManager::startSurface(
154
153
  void FabricUIManager::stopSurface(facebook::react::SurfaceId surfaceId) noexcept {
155
154
  m_surfaceManager->stopSurface(surfaceId);
156
155
  auto &rootDescriptor = m_registry.componentViewDescriptorWithTag(surfaceId);
156
+ rootDescriptor.view.as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>()->stop();
157
157
  m_registry.enqueueComponentViewWithComponentHandle(
158
158
  facebook::react::RootShadowNode::Handle(), surfaceId, rootDescriptor);
159
159
  }
160
160
 
161
- winrt::Microsoft::ReactNative::ReactNativeIsland FabricUIManager::GetReactNativeIsland(
162
- facebook::react::SurfaceId surfaceId) const noexcept {
163
- return m_surfaceRegistry.at(surfaceId).wkRootView.get();
164
- }
165
-
166
161
  facebook::react::Size FabricUIManager::measureSurface(
167
162
  facebook::react::SurfaceId surfaceId,
168
163
  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>());
@@ -21,6 +21,10 @@ namespace Microsoft.ReactNative.Composition
21
21
  [experimental]
22
22
  delegate void ComponentIslandComponentViewInitializer(ContentIslandComponentView view);
23
23
 
24
+ [webhosthidden]
25
+ [experimental]
26
+ delegate void PortalComponentViewInitializer(PortalComponentView view);
27
+
24
28
  [experimental]
25
29
  [webhosthidden]
26
30
  delegate Microsoft.UI.Composition.Visual CreateVisualDelegate(Microsoft.ReactNative.ComponentView view);
@@ -48,6 +52,15 @@ namespace Microsoft.ReactNative.Composition
48
52
  };
49
53
  }
50
54
 
55
+ [webhosthidden]
56
+ [experimental]
57
+ DOC_STRING("StateData type to be used with a PortalComponentView. The LayoutConstraints and PointScaleFactor will be used to layout the content of the Portal")
58
+ interface IPortalStateData
59
+ {
60
+ Microsoft.ReactNative.LayoutConstraints LayoutConstraints { get; };
61
+ Single PointScaleFactor { get; };
62
+ };
63
+
51
64
  [webhosthidden]
52
65
  [experimental]
53
66
  DOC_STRING(".")
@@ -55,10 +68,11 @@ namespace Microsoft.ReactNative.Composition
55
68
  {
56
69
  void SetViewComponentViewInitializer(ViewComponentViewInitializer initializer);
57
70
  void SetContentIslandComponentViewInitializer(ComponentIslandComponentViewInitializer initializer);
71
+ void SetPortalComponentViewInitializer(PortalComponentViewInitializer initializer);
58
72
  void SetCreateVisualHandler(CreateVisualDelegate impl);
59
73
  void SetViewFeatures(ComponentViewFeatures viewFeatures);
60
74
  void SetUpdateLayoutMetricsHandler(UpdateLayoutMetricsDelegate impl);
61
75
  void SetVisualToMountChildrenIntoHandler(VisualToMountChildrenIntoDelegate impl);
62
76
  };
63
77
 
64
- } // namespace Microsoft.ReactNative
78
+ } // namespace Microsoft.ReactNative.Composition
@@ -15,6 +15,7 @@
15
15
  #include "ReactInstanceSettings.h"
16
16
 
17
17
  #ifdef USE_FABRIC
18
+ #include <Fabric/Composition/Modal/WindowsModalHostViewComponentView.h>
18
19
  #include <Fabric/WindowsComponentDescriptorRegistry.h>
19
20
  #include <ReactPackageBuilder.h>
20
21
  #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
@@ -115,6 +116,10 @@ IAsyncAction ReactNativeHost::ReloadInstance() noexcept {
115
116
  #endif
116
117
  m_instanceSettings.UseWebDebugger());
117
118
 
119
+ #ifdef USE_FABRIC
120
+ winrt::Microsoft::ReactNative::Composition::implementation::RegisterWindowsModalHostNativeComponent(m_packageBuilder);
121
+ #endif
122
+
118
123
  if (auto packageProviders = InstanceSettings().PackageProviders()) {
119
124
  for (auto const &packageProvider : packageProviders) {
120
125
  packageProvider.CreatePackage(m_packageBuilder);
@@ -6,6 +6,8 @@ import "ReactCoreInjection.idl";
6
6
  import "ReactNativeHost.idl";
7
7
  import "Theme.idl";
8
8
  import "IReactViewComponentBuilder.idl";
9
+ import "CompositionComponentView.idl";
10
+
9
11
  #include "NamespaceRedirect.h"
10
12
  #include "DocString.h"
11
13
 
@@ -83,7 +85,9 @@ namespace Microsoft.ReactNative
83
85
 
84
86
  #ifdef USE_WINUI3
85
87
  ReactNativeIsland(Microsoft.UI.Composition.Compositor compositor);
86
- ReactNativeIsland(Microsoft.UI.Composition.Compositor compositor, Microsoft.ReactNative.IReactContext context, Microsoft.ReactNative.ComponentView componentView);
88
+
89
+ DOC_STRING("Used to create react portals, such as a native modal component.")
90
+ static ReactNativeIsland CreatePortal(Microsoft.ReactNative.Composition.PortalComponentView portal);
87
91
  #endif
88
92
 
89
93
  DOC_STRING(
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.77.6</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.77.8</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>77</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>6</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>8</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>faf22821e34fd9786923c6241e445b2f9fb530bd</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>2d5d4403e856e1c3862117ce5e30c39781eeb69d</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -290,6 +290,10 @@ fire_and_forget WinRTWebSocketResource2::PerformWrite(string &&message, bool isB
290
290
  }
291
291
 
292
292
  IAsyncAction WinRTWebSocketResource2::SendPendingMessages() noexcept {
293
+ // Enforcing execution in the background queue.
294
+ // Awaiting of this coroutine will schedule its execution in the thread pool, ignoring the intended dispatch queue.
295
+ co_await resume_in_queue(m_backgroundQueue);
296
+
293
297
  auto self = shared_from_this();
294
298
 
295
299
  while (!self->m_outgoingMessages.empty()) {
@@ -334,6 +338,7 @@ IAsyncAction WinRTWebSocketResource2::SendPendingMessages() noexcept {
334
338
  auto result = async.ErrorCode();
335
339
  if (result < 0) {
336
340
  Fail(std::move(result), ErrorType::Send);
341
+ co_return;
337
342
  }
338
343
  }
339
344
  }
@@ -117,10 +117,10 @@
117
117
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\Modal\WindowsModalHostViewComponentView.cpp">
118
118
  <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
119
119
  </ClCompile>
120
- <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\Modal\WindowsModalHostViewShadowNode.cpp">
120
+ <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\ParagraphComponentView.cpp">
121
121
  <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
122
122
  </ClCompile>
123
- <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\ParagraphComponentView.cpp">
123
+ <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\PortalComponentView.cpp">
124
124
  <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
125
125
  </ClCompile>
126
126
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\RootComponentView.cpp">
@@ -171,9 +171,6 @@
171
171
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiComponentDescriptor.cpp">
172
172
  <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
173
173
  </ClCompile>
174
- <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiViewComponentDescriptor.cpp">
175
- <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
176
- </ClCompile>
177
174
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiEventEmitter.cpp">
178
175
  <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
179
176
  </ClCompile>
@@ -183,6 +180,9 @@
183
180
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiShadowNode.cpp">
184
181
  <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
185
182
  </ClCompile>
183
+ <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiPortalShadowNode.cpp">
184
+ <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
185
+ </ClCompile>
186
186
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiViewShadowNode.cpp">
187
187
  <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
188
188
  </ClCompile>
@@ -323,6 +323,7 @@
323
323
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\Modal\WindowsModalHostViewComponentView.h" />
324
324
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\Modal\WindowsModalHostViewSate.h" />
325
325
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\ParagraphComponentView.h" />
326
+ <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\PortalComponentView.h" />
326
327
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\RootComponentView.h" />
327
328
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\ScrollViewComponentView.h" />
328
329
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\SwitchComponentView.h" />
@@ -179,9 +179,6 @@
179
179
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\Modal\WindowsModalHostViewComponentView.cpp">
180
180
  <Filter>Source Files\Fabric\Composition</Filter>
181
181
  </ClCompile>
182
- <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\Modal\WindowsModalHostViewShadowNode.cpp">
183
- <Filter>Source Files\Fabric\Composition</Filter>
184
- </ClCompile>
185
182
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\ParagraphComponentView.cpp">
186
183
  <Filter>Source Files\Fabric\Composition</Filter>
187
184
  </ClCompile>
@@ -245,9 +242,9 @@
245
242
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\platform\react\renderer\textlayoutmanager\TextLayoutManager.cpp">
246
243
  <Filter>Source Files\Fabric\platform\react\renderer\textlayoutmanager</Filter>
247
244
  </ClCompile>
245
+ <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\PortalComponentView.cpp" />
248
246
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\RootComponentView.cpp" />
249
247
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\UnimplementedNativeViewComponentView.cpp" />
250
- <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiViewComponentDescriptor.cpp" />
251
248
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiViewProps.cpp" />
252
249
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\WindowsComponentDescriptorRegistry.cpp" />
253
250
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\UiaHelpers.cpp" />
@@ -301,6 +298,7 @@
301
298
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\react\renderer\runtimescheduler\Task.cpp" />
302
299
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\react\renderer\components\scrollview\ScrollEvent.cpp" />
303
300
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\platform\react\renderer\graphics\PlatformColorUtils.cpp" />
301
+ <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiPortalShadowNode.cpp" />
304
302
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiViewShadowNode.cpp" />
305
303
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiState.cpp" />
306
304
  <ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Utils\ThemeUtils.cpp" />
@@ -794,6 +792,7 @@
794
792
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\platform\react\renderer\textlayoutmanager\TextLayoutManager.h">
795
793
  <Filter>Header Files\Fabric\platform\react\renderer\textlayoutmanager</Filter>
796
794
  </ClInclude>
795
+ <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\PortalComponentView.h" />
797
796
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\RootComponentView.h" />
798
797
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiViewProps.h" />
799
798
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiViewComponentDescriptor.h" />