react-native-windows 0.76.8 → 0.76.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/Libraries/Components/Button.windows.js +9 -0
  2. package/Libraries/Components/Pressable/Pressable.windows.js +9 -0
  3. package/Libraries/Components/TextInput/TextInput.windows.js +11 -1
  4. package/Libraries/Components/Touchable/TouchableBounce.windows.js +229 -0
  5. package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +373 -0
  6. package/Libraries/Components/Touchable/TouchableOpacity.windows.js +7 -0
  7. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +8 -0
  8. package/Libraries/Components/View/View.windows.js +11 -1
  9. package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
  10. package/Libraries/Components/View/ViewAccessibility.windows.js +3 -0
  11. package/Libraries/Components/View/ViewPropTypes.windows.js +3 -0
  12. package/Libraries/Image/Image.windows.js +7 -0
  13. package/Libraries/Modal/Modal.windows.js +4 -1
  14. package/Libraries/Text/Text.windows.js +14 -1
  15. package/Libraries/Text/TextProps.windows.js +3 -0
  16. package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
  17. package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.cpp +97 -0
  18. package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.h +53 -0
  19. package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.h +160 -17
  20. package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +8 -10
  21. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +4 -2
  22. package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
  23. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +428 -39
  24. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +39 -1
  25. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +55 -33
  26. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +5 -3
  27. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +43 -5
  28. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
  29. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.cpp +115 -0
  30. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.h +41 -0
  31. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp +298 -0
  32. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.h +59 -0
  33. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +106 -56
  34. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +2 -0
  35. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +163 -10
  36. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +17 -1
  37. package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +4 -2
  38. package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +9 -1
  39. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +348 -316
  40. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
  41. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +78 -0
  42. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
  43. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +22 -0
  44. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -5
  45. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +99 -37
  46. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
  47. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +81 -22
  48. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +21 -2
  49. package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +6 -1
  50. package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +41 -37
  51. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +76 -33
  52. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +8 -2
  53. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +1 -6
  54. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
  55. package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
  56. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +5 -8
  57. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorParser.h +1 -2
  58. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +1 -1
  59. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +15 -1
  60. package/Microsoft.ReactNative/IReactContext.cpp +2 -2
  61. package/Microsoft.ReactNative/IReactContext.h +1 -1
  62. package/Microsoft.ReactNative/IReactContext.idl +2 -2
  63. package/Microsoft.ReactNative/IReactPackageBuilder.idl +3 -3
  64. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +97 -87
  65. package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +4 -0
  66. package/Microsoft.ReactNative/Modules/AlertModule.cpp +9 -4
  67. package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +1 -1
  68. package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +32 -35
  69. package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +7 -4
  70. package/Microsoft.ReactNative/Modules/AppStateModule.cpp +1 -1
  71. package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +2 -2
  72. package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +2 -2
  73. package/Microsoft.ReactNative/Modules/ClipboardModule.cpp +1 -1
  74. package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
  75. package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +3 -3
  76. package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +1 -1
  77. package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +7 -5
  78. package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -1
  79. package/Microsoft.ReactNative/Modules/Timing.cpp +2 -2
  80. package/Microsoft.ReactNative/ReactHost/IReactInstance.h +5 -0
  81. package/Microsoft.ReactNative/ReactHost/React.h +0 -3
  82. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +36 -12
  83. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
  84. package/Microsoft.ReactNative/ReactNativeHost.cpp +9 -4
  85. package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
  86. package/Microsoft.ReactNative/ReactPackageBuilder.cpp +3 -3
  87. package/Microsoft.ReactNative/ReactPackageBuilder.h +4 -4
  88. package/Microsoft.ReactNative/Utils/Helpers.cpp +0 -2
  89. package/Microsoft.ReactNative/Views/DevMenu.cpp +6 -6
  90. package/Microsoft.ReactNative/Views/DevMenu.h +1 -1
  91. package/Microsoft.ReactNative/XamlUIService.cpp +13 -7
  92. package/Microsoft.ReactNative/XamlUIService.h +4 -1
  93. package/Microsoft.ReactNative/XamlUIService.idl +2 -0
  94. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +6 -2
  95. package/Microsoft.ReactNative.Cxx/NativeModules.h +29 -0
  96. package/Microsoft.ReactNative.Cxx/ReactContext.h +1 -1
  97. package/Microsoft.ReactNative.Cxx/XamlUtils.h +12 -0
  98. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  99. package/PropertySheets/React.Cpp.props +3 -0
  100. package/PropertySheets/WebView2.props +1 -1
  101. package/PropertySheets/WinUI.props +5 -4
  102. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +253 -0
  103. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +799 -0
  104. package/Shared/InspectorPackagerConnection.cpp +2 -5
  105. package/Shared/InspectorPackagerConnection.h +2 -2
  106. package/Shared/Networking/WinRTWebSocketResource.cpp +369 -7
  107. package/Shared/Networking/WinRTWebSocketResource.h +118 -0
  108. package/Shared/Shared.vcxitems +12 -5
  109. package/Shared/Shared.vcxitems.filters +11 -4
  110. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
  111. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
  112. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
  113. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
  114. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
  115. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
  116. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
  117. package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
  118. package/codegen/react/components/rnwcore/ModalHostView.g.h +279 -0
  119. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
  120. package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
  121. package/codegen/react/components/rnwcore/Switch.g.h +263 -0
  122. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
  123. package/just-task.js +1 -1
  124. package/package.json +3 -3
  125. package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +0 -191
  126. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
  127. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
  128. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
@@ -3,13 +3,13 @@
3
3
 
4
4
  #include "pch.h"
5
5
 
6
- #ifndef CORE_ABI
6
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
7
7
  #include <Modules/NativeUIManager.h>
8
8
  #include <Modules/PaperUIManagerModule.h>
9
+ #include <Views/ShadowNodeBase.h>
9
10
  #endif
10
11
 
11
12
  #include <Utils/Helpers.h>
12
- #include <Views/ShadowNodeBase.h>
13
13
  #include <Views/XamlFeatures.h>
14
14
  #include "NativeAnimatedNodeManager.h"
15
15
  #include "PropsAnimatedNode.h"
@@ -84,9 +84,11 @@ void PropsAnimatedNode::DisconnectFromView(int64_t viewTag) {
84
84
  }
85
85
 
86
86
  if (m_centerPointAnimation) {
87
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
87
88
  if (const auto target = GetUIElement()) {
88
89
  target.StopAnimation(m_centerPointAnimation);
89
90
  }
91
+ #endif
90
92
  m_centerPointAnimation = nullptr;
91
93
  }
92
94
  m_needsCenterPointAnimation = false;
@@ -140,6 +142,7 @@ void PropsAnimatedNode::UpdateView() {
140
142
  }
141
143
  }
142
144
 
145
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
143
146
  static void EnsureUIElementDirtyForRender(xaml::UIElement uiElement) {
144
147
  auto compositeMode = uiElement.CompositeMode();
145
148
  switch (compositeMode) {
@@ -153,16 +156,19 @@ static void EnsureUIElementDirtyForRender(xaml::UIElement uiElement) {
153
156
  }
154
157
  uiElement.CompositeMode(compositeMode);
155
158
  }
159
+ #endif
156
160
 
157
161
  void PropsAnimatedNode::StartAnimations() {
158
162
  assert(m_useComposition);
159
163
  if (m_expressionAnimations.size()) {
160
164
  AnimationView view = GetAnimationView();
161
165
  if (view) {
166
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
162
167
  // Work around for https://github.com/microsoft/microsoft-ui-xaml/issues/2511
163
168
  if (view.m_element) {
164
169
  EnsureUIElementDirtyForRender(view.m_element);
165
170
  }
171
+ #endif
166
172
  for (const auto &anim : m_expressionAnimations) {
167
173
  if (anim.second.Target() == L"Translation.X") {
168
174
  m_subchannelPropertySet.StartAnimation(L"TranslationX", anim.second);
@@ -177,18 +183,20 @@ void PropsAnimatedNode::StartAnimations() {
177
183
  m_subchannelPropertySet.StartAnimation(L"ScaleY", anim.second);
178
184
  StartAnimation(view, m_scaleCombined);
179
185
  } else if (anim.second.Target() == L"Rotation") {
186
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
180
187
  if (view.m_element) {
181
188
  view.m_element.RotationAxis(m_rotationAxis);
182
- #ifdef USE_FABRIC
183
- } else {
189
+ }
190
+ #else
191
+ if (view.m_componentView) {
184
192
  auto visual =
185
193
  winrt::Microsoft::ReactNative::Composition::Experimental::CompositionContextHelper::InnerVisual(
186
194
  view.m_componentView
187
195
  .as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>()
188
196
  ->Visual());
189
197
  visual.RotationAxis(m_rotationAxis);
190
- #endif
191
198
  }
199
+ #endif
192
200
  StartAnimation(view, anim.second);
193
201
  } else {
194
202
  StartAnimation(view, anim.second);
@@ -322,20 +330,18 @@ void PropsAnimatedNode::MakeAnimation(int64_t valueNodeTag, FacadeType facadeTyp
322
330
  }
323
331
  }
324
332
 
333
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
325
334
  Microsoft::ReactNative::ShadowNodeBase *PropsAnimatedNode::GetShadowNodeBase() {
326
- #ifndef CORE_ABI
327
335
  if (const auto uiManager = Microsoft::ReactNative::GetNativeUIManager(m_context).lock()) {
328
336
  if (const auto nativeUIManagerHost = uiManager->getHost()) {
329
337
  return static_cast<Microsoft::ReactNative::ShadowNodeBase *>(
330
338
  nativeUIManagerHost->FindShadowNodeForTag(m_connectedViewTag));
331
339
  }
332
340
  }
333
- #endif
334
341
  return nullptr;
335
342
  }
336
343
 
337
344
  xaml::UIElement PropsAnimatedNode::GetUIElement() {
338
- #ifndef CORE_ABI
339
345
  if (IsRS5OrHigher()) {
340
346
  if (const auto shadowNodeBase = GetShadowNodeBase()) {
341
347
  if (const auto shadowNodeView = shadowNodeBase->GetView()) {
@@ -343,12 +349,12 @@ xaml::UIElement PropsAnimatedNode::GetUIElement() {
343
349
  }
344
350
  }
345
351
  }
346
- #endif
347
352
  return nullptr;
348
353
  }
354
+ #endif
349
355
 
350
356
  void PropsAnimatedNode::CommitProps() {
351
- #ifndef CORE_ABI
357
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
352
358
  if (const auto node = GetShadowNodeBase()) {
353
359
  if (!node->m_zombie) {
354
360
  node->updateProperties(m_props);
@@ -358,43 +364,35 @@ void PropsAnimatedNode::CommitProps() {
358
364
  }
359
365
 
360
366
  PropsAnimatedNode::AnimationView PropsAnimatedNode::GetAnimationView() {
361
- #ifdef USE_FABRIC
362
- if (auto fabricuiManager = FabricUIManager::FromProperties(m_context.Properties())) {
363
- auto componentView = fabricuiManager->GetViewRegistry().findComponentViewWithTag(
364
- static_cast<facebook::react::Tag>(m_connectedViewTag));
365
- if (componentView) {
366
- return {nullptr, componentView};
367
- }
368
- }
369
- #endif // USE_FABRIC
370
- #ifndef CORE_ABI
367
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
371
368
  if (IsRS5OrHigher()) {
372
369
  if (const auto shadowNodeBase = GetShadowNodeBase()) {
373
370
  if (const auto shadowNodeView = shadowNodeBase->GetView()) {
374
- #ifdef USE_FABRIC
375
- return {shadowNodeView.as<xaml::UIElement>(), nullptr};
376
- #else
377
371
  return {shadowNodeView.as<xaml::UIElement>()};
378
- #endif
379
372
  }
380
373
  }
381
374
  }
382
- #endif // CORE_ABI
383
-
384
- #ifdef USE_FABRIC
385
- return {nullptr, nullptr};
386
375
  #else
387
- return {nullptr};
376
+ if (auto fabricuiManager = FabricUIManager::FromProperties(m_context.Properties())) {
377
+ auto componentView = fabricuiManager->GetViewRegistry().findComponentViewWithTag(
378
+ static_cast<facebook::react::Tag>(m_connectedViewTag));
379
+ if (componentView) {
380
+ return {componentView};
381
+ }
382
+ }
388
383
  #endif
384
+ return {nullptr};
389
385
  }
390
386
 
391
387
  void PropsAnimatedNode::StartAnimation(
392
388
  const AnimationView &view,
393
389
  const comp::CompositionAnimation &animation) noexcept {
390
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
394
391
  if (view.m_element) {
395
392
  view.m_element.StartAnimation(animation);
396
- #ifdef USE_FABRIC
397
- } else if (view.m_componentView) {
393
+ }
394
+ #else
395
+ if (view.m_componentView) {
398
396
  auto baseComponentView =
399
397
  view.m_componentView.as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>();
400
398
  auto visual = winrt::Microsoft::ReactNative::Composition::Experimental::CompositionContextHelper::InnerVisual(
@@ -414,17 +412,16 @@ void PropsAnimatedNode::StartAnimation(
414
412
  }
415
413
  visual.StartAnimation(targetProp, animation);
416
414
  }
417
- #endif
418
415
  }
416
+ #endif
419
417
  }
420
418
 
421
419
  comp::CompositionPropertySet PropsAnimatedNode::EnsureCenterPointPropertySet(const AnimationView &view) noexcept {
422
- #ifndef CORE_ABI
420
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
423
421
  if (view.m_element) {
424
422
  return GetShadowNodeBase()->EnsureTransformPS();
425
423
  }
426
- #endif
427
- #ifdef USE_FABRIC
424
+ #else
428
425
  if (view.m_componentView) {
429
426
  return view.m_componentView.as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>()
430
427
  ->EnsureCenterPointPropertySet();
@@ -36,23 +36,26 @@ class PropsAnimatedNode final : public AnimatedNode {
36
36
 
37
37
  private:
38
38
  struct AnimationView {
39
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
39
40
  xaml::UIElement m_element;
40
- #ifdef USE_FABRIC
41
+ #else
41
42
  winrt::Microsoft::ReactNative::ComponentView m_componentView;
42
43
  #endif
43
44
  operator bool() const noexcept {
44
- #ifdef USE_FABRIC
45
- return m_element || m_componentView;
46
- #else
45
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
47
46
  return m_element != nullptr;
47
+ #else
48
+ return m_componentView != nullptr;
48
49
  #endif
49
50
  }
50
51
  };
51
52
 
52
53
  void CommitProps();
53
54
  void MakeAnimation(int64_t valueNodeTag, FacadeType facadeType);
55
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
54
56
  Microsoft::ReactNative::ShadowNodeBase *GetShadowNodeBase();
55
57
  xaml::UIElement GetUIElement();
58
+ #endif
56
59
  AnimationView GetAnimationView();
57
60
  void StartAnimation(const AnimationView &view, const comp::CompositionAnimation &animation) noexcept;
58
61
  comp::CompositionPropertySet EnsureCenterPointPropertySet(const AnimationView &view) noexcept;
@@ -21,7 +21,7 @@ void AppState::Initialize(winrt::Microsoft::ReactNative::ReactContext const &rea
21
21
  // We need to register for notifications from the XAML thread.
22
22
  if (auto dispatcher = reactContext.UIDispatcher()) {
23
23
  dispatcher.Post([this]() {
24
- auto currentApp = xaml::TryGetCurrentApplication();
24
+ auto currentApp = xaml::TryGetCurrentUwpXamlApplication();
25
25
 
26
26
  if (!IsWinUI3Island() && currentApp != nullptr) {
27
27
  #ifndef USE_WINUI3
@@ -44,7 +44,7 @@ static const React::ReactPropertyId<React::ReactNonAbiValue<std::shared_ptr<AppT
44
44
  AppThemeHolder::AppThemeHolder(const Mso::React::IReactContext &context) : m_context(&context) {
45
45
  NotifyHighContrastChanged();
46
46
 
47
- if (auto currentApp = xaml::TryGetCurrentApplication()) {
47
+ if (auto currentApp = xaml::TryGetCurrentUwpXamlApplication()) {
48
48
  if (IsWinUI3Island()) {
49
49
  m_wmSubscription = SubscribeToWindowMessage(
50
50
  ReactNotificationService(m_context->Notifications()), WM_THEMECHANGED, [this](const auto &, const auto &) {
@@ -77,7 +77,7 @@ void AppThemeHolder::SetCallback(
77
77
 
78
78
  void AppThemeHolder::NotifyHighContrastChanged() noexcept {
79
79
  m_appThemeData.isHighContrast =
80
- xaml::TryGetCurrentApplication() ? m_accessibilitySettings.HighContrast() : IsInHighContrastWin32();
80
+ xaml::TryGetCurrentUwpXamlApplication() ? m_accessibilitySettings.HighContrast() : IsInHighContrastWin32();
81
81
  m_appThemeData.highContrastColors.ButtonFaceColor =
82
82
  FormatRGB(m_uiSettings.UIElementColor(winrt::UIElementType::ButtonFace));
83
83
  m_appThemeData.highContrastColors.ButtonTextColor =
@@ -50,7 +50,7 @@ ApplicationTheme CurrentThemeFromUISettings(const winrt::Windows::UI::ViewManage
50
50
 
51
51
  ApplicationTheme Appearance::GetCurrentTheme() noexcept {
52
52
  assert(m_context.UIDispatcher().HasThreadAccess()); // xaml::Application is only accessible on the UI thread
53
- if (auto currentApp = xaml::TryGetCurrentApplication()) {
53
+ if (auto currentApp = xaml::TryGetCurrentUwpXamlApplication()) {
54
54
  return currentApp.RequestedTheme();
55
55
  }
56
56
 
@@ -74,7 +74,7 @@ void Appearance::RequeryTheme() noexcept {
74
74
 
75
75
  void Appearance::InitOnUIThread(const Mso::React::IReactContext &context) noexcept {
76
76
  xaml::ApplicationTheme theme = ApplicationTheme::Light;
77
- if (auto currentApp = xaml::TryGetCurrentApplication()) {
77
+ if (auto currentApp = xaml::TryGetCurrentUwpXamlApplication()) {
78
78
  theme = currentApp.RequestedTheme();
79
79
  } else {
80
80
  theme = CurrentThemeFromUISettings(winrt::Windows::UI::ViewManagement::UISettings());
@@ -48,7 +48,7 @@ void Clipboard::getString(React::ReactPromise<std::string> result) noexcept {
48
48
  );
49
49
  }
50
50
 
51
- void Clipboard::setString(std::wstring content) noexcept {
51
+ void Clipboard::setString(winrt::hstring content) noexcept {
52
52
  m_reactContext.UIDispatcher().Post([=] {
53
53
  DataTransfer::DataPackage data;
54
54
  data.SetText(content);
@@ -18,7 +18,7 @@ struct Clipboard {
18
18
  void getString(winrt::Microsoft::ReactNative::ReactPromise<std::string> result) noexcept;
19
19
 
20
20
  REACT_METHOD(setString)
21
- void setString(std::wstring content) noexcept;
21
+ void setString(winrt::hstring content) noexcept;
22
22
 
23
23
  winrt::Microsoft::ReactNative::ReactContext m_reactContext;
24
24
  };
@@ -36,7 +36,7 @@ DeviceInfoHolder::DeviceInfoHolder(const Mso::React::IReactContext &context) : m
36
36
  }
37
37
 
38
38
  void DeviceInfoHolder::InitDeviceInfoHolder(const Mso::React::IReactContext &context) noexcept {
39
- if (xaml::TryGetCurrentApplication() || IsFabricEnabled(context.Properties())) {
39
+ if (xaml::TryGetCurrentUwpXamlApplication() || IsFabricEnabled(context.Properties())) {
40
40
  auto deviceInfoHolder = std::make_shared<DeviceInfoHolder>(context);
41
41
 
42
42
  deviceInfoHolder->updateDeviceInfo();
@@ -51,7 +51,7 @@ void DeviceInfoHolder::InitDeviceInfoHolder(const Mso::React::IReactContext &con
51
51
  }
52
52
  #endif
53
53
 
54
- if (xaml::TryGetCurrentApplication()) {
54
+ if (xaml::TryGetCurrentUwpXamlApplication()) {
55
55
  if (auto window = xaml::Window::Current()) {
56
56
  auto const &coreWindow = window.CoreWindow();
57
57
 
@@ -157,7 +157,7 @@ void DeviceInfoHolder::SetCallback(
157
157
  }
158
158
 
159
159
  void DeviceInfoHolder::updateDeviceInfo() noexcept {
160
- if (xaml::TryGetCurrentApplication() && xaml::Window::Current()) {
160
+ if (xaml::TryGetCurrentUwpXamlApplication() && xaml::Window::Current()) {
161
161
  auto const window = xaml::Window::Current().CoreWindow();
162
162
 
163
163
  m_windowWidth = window.Bounds().Width;
@@ -28,7 +28,7 @@ static const React::ReactPropertyId<bool> &ForceRTLPropertyId() noexcept {
28
28
  }
29
29
 
30
30
  void I18nManager::InitI18nInfo(const winrt::Microsoft::ReactNative::ReactPropertyBag &propertyBag) noexcept {
31
- if (xaml::TryGetCurrentApplication() && !IsXamlIsland()) {
31
+ if (xaml::TryGetCurrentUwpXamlApplication() && !IsXamlIsland()) {
32
32
  // TODO: Figure out packaged win32 app story for WinUI 3
33
33
  auto layoutDirection = winrt::Windows::ApplicationModel::Resources::Core::ResourceContext()
34
34
  .GetForCurrentView()
@@ -8,14 +8,15 @@
8
8
  #include "ReactHost/ReactInstanceWin.h"
9
9
  #include "ReactNativeHost.h"
10
10
  #include "Utils/Helpers.h"
11
- #include "XamlUtils.h"
12
11
 
13
12
  #ifdef USE_FABRIC
14
13
  #include <Fabric/Composition/CompositionContextHelper.h>
15
14
  #include <Fabric/Composition/CompositionUIService.h>
16
15
  #include <winrt/Windows.UI.Composition.h>
17
- #endif
16
+ #else
18
17
  #include <UI.Xaml.Controls.Primitives.h>
18
+ #include "XamlUtils.h"
19
+ #endif
19
20
 
20
21
  namespace Microsoft::ReactNative {
21
22
 
@@ -121,7 +122,7 @@ void LogBox::ShowOnUIThread() noexcept {
121
122
  auto host = React::implementation::ReactNativeHost::GetReactNativeHost(m_context.Properties());
122
123
  if (!host)
123
124
  return;
124
-
125
+ #ifndef USE_FABRIC
125
126
  if (!IsFabricEnabled(m_context.Properties().Handle())) {
126
127
  m_logBoxContent = React::ReactRootView();
127
128
  m_logBoxContent.ComponentName(L"LogBox");
@@ -170,7 +171,7 @@ void LogBox::ShowOnUIThread() noexcept {
170
171
  m_popup.Child(m_logBoxContent);
171
172
  m_popup.IsOpen(true);
172
173
  }
173
- #ifdef USE_FABRIC
174
+ #else
174
175
  else {
175
176
  RegisterWndClass();
176
177
 
@@ -212,7 +213,7 @@ void LogBox::HideOnUIThread() noexcept {
212
213
  if (m_hwnd) {
213
214
  ::ShowWindow(m_hwnd, SW_HIDE);
214
215
  }
215
- #endif // USE_FABRIC
216
+ #else // USE_FABRIC
216
217
  if (m_popup) {
217
218
  m_popup.Closed(m_tokenClosed);
218
219
  m_sizeChangedRevoker.revoke();
@@ -220,6 +221,7 @@ void LogBox::HideOnUIThread() noexcept {
220
221
  m_popup = nullptr;
221
222
  m_logBoxContent = nullptr;
222
223
  }
224
+ #endif // USE_FABRIC
223
225
  }
224
226
 
225
227
  void LogBox::Initialize(React::ReactContext const &reactContext) noexcept {
@@ -32,9 +32,10 @@ struct LogBox : public std::enable_shared_from_this<LogBox> {
32
32
  winrt::Microsoft::ReactNative::ReactContext m_context;
33
33
  #ifdef USE_FABRIC
34
34
  HWND m_hwnd{nullptr};
35
- #endif // USE_FABRIC
35
+ #else
36
36
  xaml::Controls::Primitives::Popup m_popup{nullptr};
37
37
  winrt::Microsoft::ReactNative::ReactRootView m_logBoxContent{nullptr};
38
+ #endif // USE_FABRIC
38
39
  xaml::FrameworkElement::SizeChanged_revoker m_sizeChangedRevoker;
39
40
  winrt::event_token m_tokenClosed;
40
41
  };
@@ -124,7 +124,7 @@ void TimerRegistry::setTimerManager(std::weak_ptr<facebook::react::TimerManager>
124
124
  void Timing::Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept {
125
125
  m_context = reactContext;
126
126
  m_properties = reactContext.Properties().Handle();
127
- m_usePostForRendering = !xaml::TryGetCurrentApplication();
127
+ m_usePostForRendering = !xaml::TryGetCurrentUwpXamlApplication();
128
128
  m_uiDispatcher = m_context.UIDispatcher().Handle();
129
129
  }
130
130
 
@@ -133,7 +133,7 @@ void Timing::InitializeBridgeless(
133
133
  const winrt::Microsoft::ReactNative::IReactPropertyBag &properties) noexcept {
134
134
  m_timerRegistry = timerRegistry;
135
135
  m_properties = properties;
136
- m_usePostForRendering = !xaml::TryGetCurrentApplication();
136
+ m_usePostForRendering = !xaml::TryGetCurrentUwpXamlApplication();
137
137
  m_uiDispatcher = {properties.Get(winrt::Microsoft::ReactNative::ReactDispatcherHelper::UIDispatcherProperty())
138
138
  .try_as<winrt::Microsoft::ReactNative::IReactDispatcher>()};
139
139
  }
@@ -6,7 +6,10 @@
6
6
 
7
7
  #include <DevSettings.h>
8
8
  #include <folly/dynamic.h>
9
+
10
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
9
11
  #include "XamlView.h"
12
+ #endif
10
13
 
11
14
  #include <functional>
12
15
  #include <string>
@@ -15,7 +18,9 @@ namespace Microsoft::ReactNative {
15
18
 
16
19
  struct INativeUIManager;
17
20
  class ExpressionAnimationStore;
21
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
18
22
  struct IXamlRootView;
23
+ #endif
19
24
 
20
25
  typedef unsigned int LiveReloadCallbackCookie;
21
26
  typedef unsigned int ErrorCallbackCookie;
@@ -22,10 +22,7 @@
22
22
  #undef GetCurrentTime
23
23
  #endif
24
24
 
25
- #ifndef CORE_ABI
26
- // The IReactInstance.h brings dependency on XAML. Exclude it for the UI technology independent code.
27
25
  #include <IReactInstance.h>
28
- #endif
29
26
 
30
27
  #include <Shared/IReactRootView.h>
31
28
 
@@ -67,11 +67,16 @@
67
67
  #include <react/runtime/TimerManager.h>
68
68
  #endif
69
69
 
70
- #ifndef CORE_ABI
70
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
71
71
  #include <LayoutService.h>
72
+ #include <XamlUIService.h>
73
+ #include "Modules/NativeUIManager.h"
74
+ #include "Modules/PaperUIManagerModule.h"
75
+ #endif
76
+
77
+ #ifndef CORE_ABI
72
78
  #include <Utils/UwpPreparedScriptStore.h>
73
79
  #include <Utils/UwpScriptStore.h>
74
- #include <XamlUIService.h>
75
80
  #include "ConfigureBundlerDlg.h"
76
81
  #include "Modules/AccessibilityInfoModule.h"
77
82
  #include "Modules/AlertModule.h"
@@ -82,8 +87,6 @@
82
87
  #include "Modules/I18nManagerModule.h"
83
88
  #include "Modules/LinkingManagerModule.h"
84
89
  #include "Modules/LogBoxModule.h"
85
- #include "Modules/NativeUIManager.h"
86
- #include "Modules/PaperUIManagerModule.h"
87
90
  #else
88
91
  #include "Modules/DesktopTimingModule.h"
89
92
  #endif
@@ -164,7 +167,7 @@ struct BridgeUIBatchInstanceCallback final : public facebook::react::InstanceCal
164
167
  UIBatchCompleteCallbackProperty())) {
165
168
  (*callback)(instance->m_reactContext->Properties());
166
169
  }
167
- #ifndef CORE_ABI
170
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
168
171
  if (auto uiManager = Microsoft::ReactNative::GetNativeUIManager(*instance->m_reactContext).lock()) {
169
172
  uiManager->onBatchComplete();
170
173
  }
@@ -189,7 +192,7 @@ struct BridgeUIBatchInstanceCallback final : public facebook::react::InstanceCal
189
192
  UIBatchCompleteCallbackProperty())) {
190
193
  (*callback)(instance->m_reactContext->Properties());
191
194
  }
192
- #ifndef CORE_ABI
195
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
193
196
  if (auto uiManager = Microsoft::ReactNative::GetNativeUIManager(*instance->m_reactContext).lock()) {
194
197
  uiManager->onBatchComplete();
195
198
  }
@@ -347,15 +350,16 @@ void ReactInstanceWin::LoadModules(
347
350
  }
348
351
  #endif
349
352
 
350
- #ifndef CORE_ABI
351
-
353
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
352
354
  if (!IsBridgeless()) {
353
355
  registerTurboModule(
354
356
  L"UIManager",
355
357
  // TODO: Use MakeTurboModuleProvider after it satisfies ReactNativeSpecs::UIManagerSpec
356
358
  winrt::Microsoft::ReactNative::MakeModuleProvider<::Microsoft::ReactNative::UIManager>());
357
359
  }
360
+ #endif
358
361
 
362
+ #ifndef CORE_ABI
359
363
  registerTurboModule(
360
364
  L"AccessibilityInfo",
361
365
  winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::AccessibilityInfo>());
@@ -497,7 +501,7 @@ void ReactInstanceWin::Initialize() noexcept {
497
501
 
498
502
  void ReactInstanceWin::InitDevMenu() noexcept {
499
503
  Microsoft::ReactNative::DevMenuManager::InitDevMenu(m_reactContext, [weakReactHost = m_weakReactHost]() noexcept {
500
- #ifndef CORE_ABI
504
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
501
505
  Microsoft::ReactNative::ShowConfigureBundlerDialog(weakReactHost);
502
506
  #endif // CORE_ABI
503
507
  });
@@ -585,6 +589,24 @@ std::unique_ptr<facebook::jsi::PreparedScriptStore> CreatePreparedScriptStore()
585
589
  }
586
590
 
587
591
  #ifdef USE_FABRIC
592
+
593
+ typedef HRESULT(__stdcall *SetThreadDescriptionFn)(HANDLE, PCWSTR);
594
+ void SetJSThreadDescription() noexcept {
595
+ // Office still supports Server 2016 so we need to use Run Time Dynamic Linking and cannot just use:
596
+ // ::SetThreadDescription(GetCurrentThread(), L"React-Native JavaScript Thread");
597
+
598
+ auto moduleHandle = GetModuleHandleW(L"kernelbase.dll");
599
+ // The description is just for developer experience, so we can skip it if kernelbase isn't already loaded
600
+ if (!moduleHandle)
601
+ return;
602
+
603
+ auto proc = GetProcAddress(moduleHandle, "SetThreadDescription");
604
+ if (!proc)
605
+ return;
606
+
607
+ reinterpret_cast<SetThreadDescriptionFn>(proc)(GetCurrentThread(), L"React-Native JavaScript Thread");
608
+ }
609
+
588
610
  void ReactInstanceWin::InitializeBridgeless() noexcept {
589
611
  InitUIQueue();
590
612
 
@@ -633,7 +655,7 @@ void ReactInstanceWin::InitializeBridgeless() noexcept {
633
655
  Mso::Copy(m_whenDestroyed)));
634
656
 
635
657
  m_jsMessageThread.Load()->runOnQueueSync([&]() {
636
- ::SetThreadDescription(GetCurrentThread(), L"React-Native JavaScript Thread");
658
+ SetJSThreadDescription();
637
659
  auto timerRegistry =
638
660
  ::Microsoft::ReactNative::TimerRegistry::CreateTimerRegistry(m_reactContext->Properties());
639
661
  auto timerRegistryRaw = timerRegistry.get();
@@ -752,7 +774,7 @@ void ReactInstanceWin::InitializeWithBridge() noexcept {
752
774
  InitUIQueue();
753
775
  InitUIMessageThread();
754
776
 
755
- #ifndef CORE_ABI
777
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
756
778
  // InitUIManager uses m_legacyReactInstance
757
779
  InitUIManager();
758
780
  #endif
@@ -1143,7 +1165,7 @@ bool ReactInstanceWin::IsBridgeless() noexcept {
1143
1165
  winrt::Microsoft::ReactNative::ReactPropertyBag(m_reactContext->Properties()));
1144
1166
  }
1145
1167
 
1146
- #ifndef CORE_ABI
1168
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
1147
1169
  void ReactInstanceWin::InitUIManager() noexcept {
1148
1170
  std::vector<std::unique_ptr<Microsoft::ReactNative::IViewManager>> viewManagers;
1149
1171
 
@@ -1441,12 +1463,14 @@ void ReactInstanceWin::AttachMeasuredRootView(
1441
1463
  if (!useFabric || m_useWebDebugger) {
1442
1464
  int64_t rootTag = -1;
1443
1465
 
1466
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
1444
1467
  if (auto uiManager = Microsoft::ReactNative::GetNativeUIManager(*m_reactContext).lock()) {
1445
1468
  rootTag = uiManager->AddMeasuredRootView(rootView);
1446
1469
  rootView->SetTag(rootTag);
1447
1470
  } else {
1448
1471
  assert(false);
1449
1472
  }
1473
+ #endif
1450
1474
 
1451
1475
  std::string jsMainModuleName = rootView->JSComponentName();
1452
1476
  folly::dynamic params = folly::dynamic::array(
@@ -111,7 +111,7 @@ class ReactInstanceWin final : public Mso::ActiveObject<IReactInstanceInternal>
111
111
  void InitNativeMessageThread() noexcept;
112
112
  void InitUIMessageThread() noexcept;
113
113
  void SetupHMRClient() noexcept;
114
- #ifndef CORE_ABI
114
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
115
115
  void InitUIManager() noexcept;
116
116
  #endif
117
117
 
@@ -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>
@@ -24,7 +25,7 @@ using namespace winrt;
24
25
  using namespace Windows::Foundation;
25
26
  using namespace Windows::Foundation::Collections;
26
27
 
27
- #ifndef CORE_ABI
28
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
28
29
  using namespace xaml;
29
30
  using namespace xaml::Controls;
30
31
  #endif
@@ -87,7 +88,7 @@ ReactNativeHostProperty() noexcept {
87
88
  IAsyncAction ReactNativeHost::ReloadInstance() noexcept {
88
89
  auto modulesProvider = std::make_shared<NativeModulesProvider>();
89
90
 
90
- #ifndef CORE_ABI
91
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
91
92
  auto viewManagersProvider = std::make_shared<ViewManagersProvider>();
92
93
  #endif
93
94
 
@@ -105,7 +106,7 @@ IAsyncAction ReactNativeHost::ReloadInstance() noexcept {
105
106
 
106
107
  m_packageBuilder = make<ReactPackageBuilder>(
107
108
  modulesProvider,
108
- #ifndef CORE_ABI
109
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
109
110
  viewManagersProvider,
110
111
  #endif
111
112
  turboModulesProvider,
@@ -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);
@@ -163,7 +168,7 @@ IAsyncAction ReactNativeHost::ReloadInstance() noexcept {
163
168
  reactOptions.SetJsiEngine(static_cast<Mso::React::JSIEngine>(m_instanceSettings.JSIEngineOverride()));
164
169
 
165
170
  reactOptions.ModuleProvider = modulesProvider;
166
- #ifndef CORE_ABI
171
+ #if !defined(CORE_ABI) && !defined(USE_FABRIC)
167
172
  reactOptions.ViewManagerProvider = viewManagersProvider;
168
173
  #endif
169
174
  reactOptions.TurboModuleProvider = turboModulesProvider;
@@ -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(