react-native-windows 0.75.0 → 0.75.2

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 (77) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/Microsoft.ReactNative/ComponentView.idl +33 -32
  3. package/Microsoft.ReactNative/Composition.Input.idl +2 -0
  4. package/Microsoft.ReactNative/CompositionComponentView.idl +43 -24
  5. package/Microsoft.ReactNative/Fabric/AbiEventEmitter.cpp +21 -0
  6. package/Microsoft.ReactNative/Fabric/AbiEventEmitter.h +23 -0
  7. package/Microsoft.ReactNative/Fabric/AbiShadowNode.cpp +7 -0
  8. package/Microsoft.ReactNative/Fabric/AbiShadowNode.h +3 -0
  9. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +318 -59
  10. package/Microsoft.ReactNative/Fabric/ComponentView.h +155 -33
  11. package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +2 -2
  12. package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +3 -0
  13. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +25 -7
  14. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +22 -4
  15. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +43 -0
  16. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +6 -1
  17. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +147 -119
  18. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +4 -8
  19. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +97 -101
  20. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +28 -52
  21. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +133 -0
  22. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +61 -0
  23. package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +1 -2
  24. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +1 -4
  25. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +1 -2
  26. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +1 -6
  27. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +0 -1
  28. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +108 -18
  29. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +33 -5
  30. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +57 -1
  31. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +6 -0
  32. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +8 -2
  33. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +2 -0
  34. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +195 -182
  35. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +1 -3
  36. package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +16 -4
  37. package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +3 -3
  38. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +12 -17
  39. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +4 -11
  40. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +19 -0
  41. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +4 -0
  42. package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +1 -2
  43. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +10 -7
  44. package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +1 -3
  45. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +20 -1
  46. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +3 -0
  47. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +13 -3
  48. package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +57 -4
  49. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +2 -0
  50. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +74 -67
  51. package/Microsoft.ReactNative/ReactNativeIsland.idl +3 -0
  52. package/PropertySheets/External/Microsoft.ReactNative.Composition.Package.props +1 -0
  53. package/PropertySheets/External/Microsoft.ReactNative.Composition.Package.targets +4 -0
  54. package/PropertySheets/External/Microsoft.ReactNative.Cpp.PackageReferences.props +14 -4
  55. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  56. package/PropertySheets/WinUI.props +1 -1
  57. package/Scripts/Microsoft.ReactNative.VersionCheck.targets +2 -0
  58. package/Shared/DevSettings.h +3 -0
  59. package/Shared/OInstance.cpp +6 -2
  60. package/Shared/Shared.vcxitems +7 -0
  61. package/just-task.js +1 -1
  62. package/package.json +13 -13
  63. package/template/cpp-app/proj/MyApp.sln +19 -19
  64. package/template/cpp-lib/proj/MyLib.sln +19 -19
  65. package/template/cs-app/proj/MyApp.sln +21 -21
  66. package/template/cs-lib/proj/MyLib.sln +21 -21
  67. package/templates/cpp-app/NuGet_Config +13 -0
  68. package/templates/cpp-app/template.config.js +6 -1
  69. package/templates/cpp-app/windows/ExperimentalFeatures.props +1 -0
  70. package/templates/cpp-app/windows/MyApp.sln +29 -19
  71. package/templates/cpp-lib/NuGet_Config +13 -0
  72. package/templates/cpp-lib/example/NuGet_Config +6 -0
  73. package/templates/cpp-lib/template.config.js +6 -1
  74. package/templates/cpp-lib/windows/ExperimentalFeatures.props +1 -0
  75. package/templates/cpp-lib/windows/MyLib.sln +35 -25
  76. package/templates/old/generateWrapper.js +3 -3
  77. package/templates/templateUtils.js +3 -1
@@ -62,16 +62,10 @@ struct WindowsTextInputComponentView
62
62
  void OnPointerMoved(
63
63
  const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept override;
64
64
 
65
- void OnKeyDown(
66
- const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
67
- const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept override;
68
- void OnKeyUp(
69
- const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
70
- const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept override;
71
- void OnCharacterReceived(
72
- const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
73
- const winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs &args) noexcept
74
- override;
65
+ void OnKeyDown(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept override;
66
+ void OnKeyUp(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept override;
67
+ void OnCharacterReceived(const winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs
68
+ &args) noexcept override;
75
69
 
76
70
  std::optional<std::string> getAcccessiblityValue() noexcept override;
77
71
  void setAcccessiblityValue(std::string &&value) noexcept override;
@@ -106,7 +100,6 @@ struct WindowsTextInputComponentView
106
100
  const facebook::react::SharedColor &cursorColor,
107
101
  const facebook::react::SharedColor &foregroundColor) noexcept;
108
102
  bool ShouldSubmit(
109
- const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
110
103
  const winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs &args) noexcept;
111
104
 
112
105
  winrt::Windows::UI::Composition::CompositionSurfaceBrush m_brush{nullptr};
@@ -162,4 +162,23 @@ void UpdateUiaProperty(
162
162
  spProviderSimple.get(), propId, CComVariant(oldValue.c_str()), CComVariant(newValue.c_str()));
163
163
  }
164
164
 
165
+ long GetLiveSetting(const std::string &liveRegion) noexcept {
166
+ if (liveRegion == "polite") {
167
+ return LiveSetting::Polite;
168
+ } else if (liveRegion == "assertive") {
169
+ return LiveSetting::Assertive;
170
+ }
171
+ return LiveSetting::Off;
172
+ }
173
+
174
+ std::string extractAccessibilityValue(const facebook::react::AccessibilityValue &value) noexcept {
175
+ if (value.now.has_value()) {
176
+ return std::to_string(value.now.value());
177
+ } else if (value.text.has_value()) {
178
+ return value.text.value();
179
+ } else {
180
+ return "";
181
+ }
182
+ }
183
+
165
184
  } // namespace winrt::Microsoft::ReactNative::implementation
@@ -29,4 +29,8 @@ void UpdateUiaProperty(
29
29
  const std::string &oldValue,
30
30
  const std::string &newValue) noexcept;
31
31
 
32
+ long GetLiveSetting(const std::string &liveRegion) noexcept;
33
+
34
+ std::string extractAccessibilityValue(const facebook::react::AccessibilityValue &value) noexcept;
35
+
32
36
  } // namespace winrt::Microsoft::ReactNative::implementation
@@ -24,8 +24,7 @@ UnimplementedNativeViewComponentView::UnimplementedNativeViewComponentView(
24
24
  reactContext,
25
25
  ComponentViewFeatures::Default &
26
26
  ~(ComponentViewFeatures::Background | ComponentViewFeatures::ShadowProps |
27
- ComponentViewFeatures::NativeBorder),
28
- false) {
27
+ ComponentViewFeatures::NativeBorder)) {
29
28
  m_labelVisual = compContext.CreateSpriteVisual();
30
29
  OuterVisual().InsertAt(m_labelVisual, 1);
31
30
  }
@@ -245,9 +245,10 @@ void FabricUIManager::RCTPerformMountInstructions(
245
245
  newChildComponentView->updateEventEmitter(newChildShadowView.eventEmitter);
246
246
  newChildComponentView->updateState(newChildShadowView.state, oldChildShadowView.state);
247
247
  newChildComponentView->updateLayoutMetrics(newChildShadowView.layoutMetrics, oldChildShadowView.layoutMetrics);
248
- newChildViewDescriptor.view.FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask::All);
248
+ newChildComponentView->FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask::All);
249
249
 
250
- parentViewDescriptor.view.MountChildComponentView(*newChildComponentView, mutation.index);
250
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(parentViewDescriptor.view)
251
+ ->MountChildComponentView(*newChildComponentView, mutation.index);
251
252
  break;
252
253
  }
253
254
 
@@ -256,7 +257,8 @@ void FabricUIManager::RCTPerformMountInstructions(
256
257
  auto &parentShadowView = mutation.parentShadowView;
257
258
  auto &oldChildViewDescriptor = m_registry.componentViewDescriptorWithTag(oldChildShadowView.tag);
258
259
  auto &parentViewDescriptor = m_registry.componentViewDescriptorWithTag(parentShadowView.tag);
259
- parentViewDescriptor.view.UnmountChildComponentView(oldChildViewDescriptor.view, mutation.index);
260
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(parentViewDescriptor.view)
261
+ ->UnmountChildComponentView(oldChildViewDescriptor.view, mutation.index);
260
262
  break;
261
263
  }
262
264
 
@@ -290,7 +292,8 @@ void FabricUIManager::RCTPerformMountInstructions(
290
292
  }
291
293
 
292
294
  if (mask != winrt::Microsoft::ReactNative::ComponentViewUpdateMask::None) {
293
- newChildViewDescriptor.view.FinalizeUpdates(mask);
295
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(newChildViewDescriptor.view)
296
+ ->FinalizeUpdates(mask);
294
297
  }
295
298
 
296
299
  break;
@@ -380,15 +383,15 @@ void FabricUIManager::schedulerDidDispatchCommand(
380
383
  folly::dynamic const &arg) {
381
384
  if (m_context.UIDispatcher().HasThreadAccess()) {
382
385
  auto descriptor = m_registry.componentViewDescriptorWithTag(shadowView.tag);
383
- descriptor.view.HandleCommand(
384
- winrt::to_hstring(commandName), winrt::make<winrt::Microsoft::ReactNative::DynamicReader>(arg));
386
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(descriptor.view)
387
+ ->HandleCommand(winrt::to_hstring(commandName), winrt::make<winrt::Microsoft::ReactNative::DynamicReader>(arg));
385
388
  } else {
386
389
  m_context.UIDispatcher().Post(
387
390
  [wkThis = weak_from_this(), commandName, tag = shadowView.tag, args = folly::dynamic(arg)]() {
388
391
  if (auto pThis = wkThis.lock()) {
389
392
  auto view = pThis->m_registry.findComponentViewWithTag(tag);
390
393
  if (view) {
391
- view.HandleCommand(
394
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(view)->HandleCommand(
392
395
  winrt::to_hstring(commandName), winrt::make<winrt::Microsoft::ReactNative::DynamicReader>(args));
393
396
  }
394
397
  }
@@ -74,9 +74,7 @@ void WindowsComponentDescriptorRegistry::Add(
74
74
  m_descriptorFlavors.back()->c_str(),
75
75
  std::static_pointer_cast<void const>(m_descriptorFlavors.back()),
76
76
  winrt::get_self<winrt::Microsoft::ReactNative::Composition::ReactCompositionViewComponentBuilder>(builder)
77
- ->IsViewComponent()
78
- ? &facebook::react::concreteComponentDescriptorConstructor<AbiViewComponentDescriptor>
79
- : &facebook::react::concreteComponentDescriptorConstructor<AbiComponentDescriptor>});
77
+ ->GetComponentDescriptorProvider()});
80
78
  }
81
79
 
82
80
  winrt::Microsoft::ReactNative::IReactViewComponentBuilder WindowsComponentDescriptorRegistry::GetDescriptor(
@@ -26,7 +26,23 @@ HostPlatformViewProps::HostPlatformViewProps(
26
26
  focusable(
27
27
  CoreFeatures::enablePropIteratorSetter
28
28
  ? sourceProps.focusable
29
- : convertRawProp(context, rawProps, "focusable", sourceProps.focusable, {})) {}
29
+ : convertRawProp(context, rawProps, "focusable", sourceProps.focusable, {})),
30
+ accessibilityPosInSet(
31
+ CoreFeatures::enablePropIteratorSetter
32
+ ? sourceProps.accessibilityPosInSet
33
+ : convertRawProp(context, rawProps, "accessibilityPosInSet", sourceProps.accessibilityPosInSet, 0)),
34
+ accessibilitySetSize(
35
+ CoreFeatures::enablePropIteratorSetter
36
+ ? sourceProps.accessibilitySetSize
37
+ : convertRawProp(context, rawProps, "accessibilitySetSize", sourceProps.accessibilitySetSize, 0)),
38
+ accessibilityLiveRegion(
39
+ CoreFeatures::enablePropIteratorSetter ? sourceProps.accessibilityLiveRegion
40
+ : convertRawProp(
41
+ context,
42
+ rawProps,
43
+ "accessibilityLiveRegion",
44
+ sourceProps.accessibilityLiveRegion,
45
+ "none")) {}
30
46
 
31
47
  #define WINDOWS_VIEW_EVENT_CASE(eventType) \
32
48
  case CONSTEXPR_RAW_PROPS_KEY_HASH("on" #eventType): { \
@@ -61,6 +77,9 @@ void HostPlatformViewProps::setProp(
61
77
  WINDOWS_VIEW_EVENT_CASE(MouseLeave);
62
78
  RAW_SET_PROP_SWITCH_CASE_BASIC(enableFocusRing);
63
79
  RAW_SET_PROP_SWITCH_CASE_BASIC(focusable);
80
+ RAW_SET_PROP_SWITCH_CASE_BASIC(accessibilityPosInSet);
81
+ RAW_SET_PROP_SWITCH_CASE_BASIC(accessibilitySetSize);
82
+ RAW_SET_PROP_SWITCH_CASE_BASIC(accessibilityLiveRegion);
64
83
  RAW_SET_PROP_SWITCH_CASE_BASIC(keyDownEvents);
65
84
  RAW_SET_PROP_SWITCH_CASE_BASIC(keyUpEvents);
66
85
  }
@@ -24,6 +24,9 @@ class HostPlatformViewProps : public BaseViewProps {
24
24
  WindowsViewEvents windowsEvents{};
25
25
  bool enableFocusRing{true};
26
26
  bool focusable{false};
27
+ int accessibilityPosInSet{0};
28
+ int accessibilitySetSize{0};
29
+ std::string accessibilityLiveRegion{"none"};
27
30
 
28
31
  // std::optional<std::string> overflowAnchor{};
29
32
  // std::optional<std::string> tooltip{};
@@ -13,16 +13,26 @@ import "CompositionComponentView.idl";
13
13
 
14
14
  namespace Microsoft.ReactNative.Composition
15
15
  {
16
+ [webhosthidden]
17
+ [experimental]
18
+ delegate void ViewComponentViewInitializer(ViewComponentView view);
19
+
20
+ [webhosthidden]
16
21
  [experimental]
17
- DOC_STRING("Provides a factory method to create an instance of a ViewComponentView. See @IReactCompositionViewComponentBuilder.SetCreateViewComponentView")
18
- delegate Microsoft.ReactNative.Composition.ViewComponentView CompositionViewComponentViewFactory(CreateCompositionComponentViewArgs args);
22
+ delegate void ComponentIslandComponentViewInitializer(ContentIslandComponentView view);
23
+
24
+ [experimental]
25
+ [webhosthidden]
26
+ delegate Microsoft.UI.Composition.Visual CreateVisualDelegate(Microsoft.ReactNative.ComponentView view);
19
27
 
20
28
  [webhosthidden]
21
29
  [experimental]
22
30
  DOC_STRING(".")
23
31
  interface IReactCompositionViewComponentBuilder
24
32
  {
25
- void SetCreateViewComponentView(CompositionViewComponentViewFactory impl);
33
+ void SetViewComponentViewInitializer(ViewComponentViewInitializer initializer);
34
+ void SetContentIslandComponentViewInitializer(ComponentIslandComponentViewInitializer initializer);
35
+ void SetCreateVisualHandler(CreateVisualDelegate impl);
26
36
  };
27
37
 
28
38
  } // namespace Microsoft.ReactNative
@@ -3,6 +3,7 @@
3
3
 
4
4
  import "ViewProps.idl";
5
5
  import "ComponentView.idl";
6
+ import "IJSValueWriter.idl";
6
7
 
7
8
  #include "DocString.h"
8
9
 
@@ -34,6 +35,18 @@ namespace Microsoft.ReactNative
34
35
  LayoutDirection LayoutDirection;
35
36
  };
36
37
 
38
+ [experimental]
39
+ runtimeclass MountChildComponentViewArgs {
40
+ ComponentView Child { get; };
41
+ UInt32 Index { get; };
42
+ };
43
+
44
+ [experimental]
45
+ runtimeclass UnmountChildComponentViewArgs {
46
+ ComponentView Child { get; };
47
+ UInt32 Index { get; };
48
+ };
49
+
37
50
  [experimental]
38
51
  DOC_STRING("A delegate that creates a @IComponentProps object for an instance of @ViewProps. See @IReactViewComponentBuilder.SetCreateProps")
39
52
  delegate IComponentProps ViewPropsFactory(ViewProps props);
@@ -54,15 +67,39 @@ namespace Microsoft.ReactNative
54
67
  delegate Object InitialStateDataFactory(IComponentProps props);
55
68
 
56
69
  [experimental]
57
- DOC_STRING("Provides a factory method to create an instance of a ComponentView. See @IReactViewComponentBuilder.SetCreateView")
58
- delegate ComponentView ComponentViewFactory(CreateComponentViewArgs args);
70
+ DOC_STRING("Provides a method to initialize an instance of a ComponentView. See @IReactViewComponentBuilder.SetComponentViewInitializer")
71
+ delegate void ComponentViewInitializer(ComponentView view);
72
+
73
+ [experimental]
74
+ delegate void HandleCommandDelegate(ComponentView source, String commandName, IJSValueReader args);
75
+
76
+ [experimental]
77
+ delegate void UpdateFinalizerDelegate(ComponentView source, ComponentViewUpdateMask updateMask);
78
+
79
+ [experimental]
80
+ delegate void UpdatePropsDelegate(ComponentView source, IComponentProps newProps, IComponentProps oldProps);
81
+
82
+ [experimental]
83
+ delegate void UpdateStateDelegate(ComponentView source, IComponentState newState);
84
+
85
+ [experimental]
86
+ delegate void MountChildComponentViewDelegate(ComponentView source, MountChildComponentViewArgs args);
87
+
88
+ [experimental]
89
+ delegate void UnmountChildComponentViewDelegate(ComponentView source, UnmountChildComponentViewArgs args);
90
+
91
+ [experimental]
92
+ runtimeclass EventEmitter {
93
+ void DispatchEvent(String eventName, JSValueArgWriter args);
94
+ };
95
+
96
+ [experimental]
97
+ delegate void UpdateEventEmitterDelegate(ComponentView source, EventEmitter eventEmitter);
59
98
 
60
99
  [webhosthidden]
61
100
  [experimental]
62
101
  interface IReactViewComponentBuilder
63
102
  {
64
- void SetCreateComponentView(ComponentViewFactory impl);
65
-
66
103
  DOC_STRING("Create an implementation of your custom Props type that will be passed to your components @Composition.ICompositionViewComponent.UpdateProps method.")
67
104
  void SetCreateProps(ViewPropsFactory impl);
68
105
 
@@ -71,9 +108,24 @@ namespace Microsoft.ReactNative
71
108
  void SetInitialStateDataFactory(InitialStateDataFactory impl);
72
109
  void SetMeasureContentHandler(MeasureContentHandler impl);
73
110
  void SetLayoutHandler(LayoutHandler impl);
111
+
112
+ void SetComponentViewInitializer(ComponentViewInitializer initializer);
113
+ void SetCustomCommandHandler(HandleCommandDelegate impl);
114
+ void SetFinalizeUpdateHandler(UpdateFinalizerDelegate impl);
115
+ void SetUpdatePropsHandler(UpdatePropsDelegate impl);
116
+ void SetUpdateStateHandler(UpdateStateDelegate impl);
117
+ void SetUpdateEventEmitterHandler(UpdateEventEmitterDelegate impl);
118
+ void SetMountChildComponentViewHandler(MountChildComponentViewDelegate impl);
119
+ void SetUnmountChildComponentViewHandler(UnmountChildComponentViewDelegate impl);
74
120
  };
75
121
 
122
+ // [exclusiveto(ShadowNode)]
123
+ // [uuid(BF2A2A64-AB8B-47FC-BE69-E31DE6FC29A4)]
124
+ // interface IShadowNodeFactory
125
+ // {
126
+ // }
76
127
 
128
+ // [composable(IShadowNodeFactory, protected)]
77
129
  [webhosthidden]
78
130
  [experimental]
79
131
  unsealed runtimeclass ShadowNode
@@ -81,6 +133,7 @@ namespace Microsoft.ReactNative
81
133
  void EnsureUnsealed();
82
134
  Object Tag { get; set; };
83
135
  Object StateData{ get; set; };
136
+ EventEmitter EventEmitter { get; };
84
137
  };
85
138
 
86
139
  [webhosthidden]
@@ -121,6 +121,7 @@
121
121
  OLD_CPPWINRT is a workaround to make target version to 19H1
122
122
  -->
123
123
  <PreprocessorDefinitions>
124
+ DISABLE_XAML_GENERATED_MAIN;
124
125
  REACTWINDOWS_BUILD;
125
126
  RN_PLATFORM=windows;
126
127
  NOMINMAX;
@@ -131,6 +132,7 @@
131
132
  WIN32=0;
132
133
  WINRT=1;
133
134
  _HAS_AUTO_PTR_ETC;
135
+ _USE_MATH_DEFINES;
134
136
  <!-- See https://cplusplus.github.io/LWG/issue3840 -->
135
137
  _SILENCE_CXX20_U8PATH_DEPRECATION_WARNING;
136
138
  %(PreprocessorDefinitions)
@@ -83,7 +83,14 @@
83
83
  #include "Modules/LogBoxModule.h"
84
84
  #include "Modules/NativeUIManager.h"
85
85
  #include "Modules/PaperUIManagerModule.h"
86
+ #else
87
+ #include "Modules/DesktopTimingModule.h"
86
88
  #endif
89
+ #include "Modules/ExceptionsManager.h"
90
+ #include "Modules/PlatformConstantsWinModule.h"
91
+ #include "Modules/ReactRootViewTagGenerator.h"
92
+ #include "Modules/SourceCode.h"
93
+ #include "Modules/StatusBarManager.h"
87
94
 
88
95
  #if !defined(CORE_ABI) || defined(USE_FABRIC)
89
96
  #include <Modules/ImageViewManagerModule.h>
@@ -111,11 +118,6 @@ using namespace winrt::Microsoft::ReactNative;
111
118
 
112
119
  namespace Mso::React {
113
120
 
114
- std::string getApplicationTempFolder() {
115
- auto local = winrt::Windows::Storage::ApplicationData::Current().TemporaryFolder().Path();
116
- return Microsoft::Common::Unicode::Utf16ToUtf8(local.c_str(), local.size()) + "\\";
117
- }
118
-
119
121
  //=============================================================================================
120
122
  // LoadedCallbackGuard ensures that the OnReactInstanceLoaded is always called.
121
123
  // It calls OnReactInstanceLoaded in destructor with a cancellation error.
@@ -397,42 +399,44 @@ void ReactInstanceWin::LoadModules(
397
399
  }
398
400
  #endif
399
401
 
400
- ::Microsoft::ReactNative::ExceptionsManager::SetRedBoxHander(
401
- winrt::Microsoft::ReactNative::ReactPropertyBag(m_reactContext->Properties()), m_redboxHandler);
402
- registerTurboModule(
403
- L"ExceptionsManager",
404
- winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::ExceptionsManager>());
402
+ if (devSettings->useTurboModulesOnly) {
403
+ ::Microsoft::ReactNative::ExceptionsManager::SetRedBoxHander(
404
+ winrt::Microsoft::ReactNative::ReactPropertyBag(m_reactContext->Properties()), m_redboxHandler);
405
+ registerTurboModule(
406
+ L"ExceptionsManager",
407
+ winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::ExceptionsManager>());
405
408
 
406
- registerTurboModule(
407
- L"StatusBarManager",
408
- winrt::Microsoft::ReactNative::MakeModuleProvider<::Microsoft::ReactNative::StatusBarManager>());
409
+ registerTurboModule(
410
+ L"StatusBarManager",
411
+ winrt::Microsoft::ReactNative::MakeModuleProvider<::Microsoft::ReactNative::StatusBarManager>());
409
412
 
410
- registerTurboModule(
411
- L"PlatformConstants",
412
- winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::PlatformConstants>());
413
+ registerTurboModule(
414
+ L"PlatformConstants",
415
+ winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::PlatformConstants>());
413
416
 
414
- uint32_t hermesBytecodeVersion = 0;
417
+ uint32_t hermesBytecodeVersion = 0;
415
418
  #if defined(USE_HERMES) && defined(ENABLE_DEVSERVER_HBCBUNDLES)
416
- hermesBytecodeVersion = ::hermes::hbc::BYTECODE_VERSION;
419
+ hermesBytecodeVersion = ::hermes::hbc::BYTECODE_VERSION;
417
420
  #endif
418
421
 
419
- std::string bundleUrl = (devSettings->useWebDebugger || devSettings->liveReloadCallback)
420
- ? facebook::react::DevServerHelper::get_BundleUrl(
421
- devSettings->sourceBundleHost,
422
- devSettings->sourceBundlePort,
423
- devSettings->debugBundlePath,
424
- devSettings->platformName,
425
- devSettings->bundleAppId,
426
- devSettings->devBundle,
427
- devSettings->useFastRefresh,
428
- devSettings->inlineSourceMap,
429
- hermesBytecodeVersion)
430
- : devSettings->bundleRootPath;
431
- ::Microsoft::ReactNative::SourceCode::SetScriptUrl(
432
- winrt::Microsoft::ReactNative::ReactPropertyBag(m_reactContext->Properties()), bundleUrl);
422
+ std::string bundleUrl = (devSettings->useWebDebugger || devSettings->liveReloadCallback)
423
+ ? facebook::react::DevServerHelper::get_BundleUrl(
424
+ devSettings->sourceBundleHost,
425
+ devSettings->sourceBundlePort,
426
+ devSettings->debugBundlePath,
427
+ devSettings->platformName,
428
+ devSettings->bundleAppId,
429
+ devSettings->devBundle,
430
+ devSettings->useFastRefresh,
431
+ devSettings->inlineSourceMap,
432
+ hermesBytecodeVersion)
433
+ : devSettings->bundleRootPath;
434
+ ::Microsoft::ReactNative::SourceCode::SetScriptUrl(
435
+ winrt::Microsoft::ReactNative::ReactPropertyBag(m_reactContext->Properties()), bundleUrl);
433
436
 
434
- registerTurboModule(
435
- L"SourceCode", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::SourceCode>());
437
+ registerTurboModule(
438
+ L"SourceCode", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::SourceCode>());
439
+ }
436
440
 
437
441
  registerTurboModule(
438
442
  L"DevSettings", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::DevSettings>());
@@ -446,6 +450,17 @@ void ReactInstanceWin::LoadModules(
446
450
  winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::LinkingManager>());
447
451
 
448
452
  registerTurboModule(L"Timing", winrt::Microsoft::ReactNative::MakeModuleProvider<::Microsoft::ReactNative::Timing>());
453
+ #else
454
+
455
+ #if defined(USE_FABRIC)
456
+ if (Microsoft::ReactNative::IsFabricEnabled(m_reactContext->Properties())) {
457
+ registerTurboModule(
458
+ L"Timing", winrt::Microsoft::ReactNative::MakeModuleProvider<::Microsoft::ReactNative::Timing>());
459
+ } else
460
+ #endif
461
+ {
462
+ registerTurboModule(L"Timing", winrt::Microsoft::ReactNative::MakeModuleProvider<::facebook::react::Timing>());
463
+ }
449
464
  #endif
450
465
 
451
466
  registerTurboModule(
@@ -553,6 +568,15 @@ Mso::DispatchQueueSettings CreateDispatchQueueSettings(
553
568
  return queueSettings;
554
569
  }
555
570
 
571
+ std::unique_ptr<facebook::jsi::PreparedScriptStore> CreatePreparedScriptStore() noexcept {
572
+ std::unique_ptr<facebook::jsi::PreparedScriptStore> preparedScriptStore = nullptr;
573
+ wchar_t tempPath[MAX_PATH];
574
+ if (GetTempPathW(static_cast<DWORD>(std::size(tempPath)), tempPath)) {
575
+ preparedScriptStore = std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(winrt::to_string(tempPath));
576
+ }
577
+ return preparedScriptStore;
578
+ }
579
+
556
580
  #ifdef USE_FABRIC
557
581
  void ReactInstanceWin::InitializeBridgeless() noexcept {
558
582
  InitUIQueue();
@@ -582,6 +606,7 @@ void ReactInstanceWin::InitializeBridgeless() noexcept {
582
606
  strongThis->Queue().Post([this, weakThis]() noexcept {
583
607
  if (auto strongThis = weakThis.GetStrongPtr()) {
584
608
  auto devSettings = strongThis->CreateDevSettings();
609
+ devSettings->useTurboModulesOnly = true;
585
610
 
586
611
  try {
587
612
  if (devSettings->useFastRefresh || devSettings->liveReloadCallback) {
@@ -619,7 +644,7 @@ void ReactInstanceWin::InitializeBridgeless() noexcept {
619
644
  }
620
645
 
621
646
  m_jsiRuntimeHolder = std::make_shared<Microsoft::ReactNative::HermesRuntimeHolder>(
622
- devSettings, m_jsMessageThread.Load(), CreateHermesPreparedScriptStore());
647
+ devSettings, m_jsMessageThread.Load(), CreatePreparedScriptStore());
623
648
  auto jsRuntime = std::make_unique<Microsoft::ReactNative::HermesJSRuntime>(m_jsiRuntimeHolder);
624
649
  jsRuntime->getRuntime();
625
650
  m_bridgelessReactInstance = std::make_unique<facebook::react::ReactInstance>(
@@ -693,19 +718,6 @@ void ReactInstanceWin::InitializeBridgeless() noexcept {
693
718
  }
694
719
  #endif
695
720
 
696
- std::unique_ptr<facebook::jsi::PreparedScriptStore> ReactInstanceWin::CreateHermesPreparedScriptStore() noexcept {
697
- std::unique_ptr<facebook::jsi::PreparedScriptStore> preparedScriptStore = nullptr;
698
- if (Microsoft::ReactNative::HasPackageIdentity()) {
699
- preparedScriptStore = std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(getApplicationTempFolder());
700
- } else {
701
- wchar_t tempPath[MAX_PATH];
702
- if (GetTempPathW(static_cast<DWORD>(std::size(tempPath)), tempPath)) {
703
- preparedScriptStore = std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(winrt::to_string(tempPath));
704
- }
705
- }
706
- return preparedScriptStore;
707
- }
708
-
709
721
  void ReactInstanceWin::FireInstanceCreatedCallback() noexcept {
710
722
  // The InstanceCreated event can be used to augment the JS environment for all JS code. So it needs to be
711
723
  // triggered before any platform JS code is run. Using m_jsMessageThread instead of jsDispatchQueue avoids
@@ -740,11 +752,21 @@ void ReactInstanceWin::InitializeWithBridge() noexcept {
740
752
  // Objects that must be created on the UI thread
741
753
  if (auto strongThis = weakThis.GetStrongPtr()) {
742
754
  InitUIDependentCalls();
743
-
744
755
  strongThis->Queue().Post([this, weakThis]() noexcept {
745
756
  if (auto strongThis = weakThis.GetStrongPtr()) {
746
757
  auto devSettings = strongThis->CreateDevSettings();
747
758
 
759
+ auto getBoolProperty = [properties = ReactPropertyBag{m_options.Properties}](
760
+ const wchar_t *ns, const wchar_t *name, bool defaultValue) noexcept -> bool {
761
+ ReactPropertyId<bool> propId{ns == nullptr ? ReactPropertyNamespace() : ReactPropertyNamespace(ns), name};
762
+ std::optional<bool> propValue = properties.Get(propId);
763
+ return propValue.value_or(defaultValue);
764
+ };
765
+
766
+ devSettings->omitNetworkingCxxModules = getBoolProperty(nullptr, L"OmitNetworkingCxxModules", false);
767
+ devSettings->useWebSocketTurboModule = getBoolProperty(nullptr, L"UseWebSocketTurboModule", false);
768
+ devSettings->useTurboModulesOnly = getBoolProperty(L"DevSettings", L"UseTurboModulesOnly", false);
769
+
748
770
  std::vector<facebook::react::NativeModuleDescription> cxxModules;
749
771
  auto nmp = std::make_shared<winrt::Microsoft::ReactNative::NativeModulesProvider>();
750
772
 
@@ -773,7 +795,7 @@ void ReactInstanceWin::InitializeWithBridge() noexcept {
773
795
  } else {
774
796
  switch (m_options.JsiEngine()) {
775
797
  case JSIEngine::Hermes: {
776
- preparedScriptStore = CreateHermesPreparedScriptStore();
798
+ preparedScriptStore = CreatePreparedScriptStore();
777
799
 
778
800
  auto hermesRuntimeHolder = std::make_shared<Microsoft::ReactNative::HermesRuntimeHolder>(
779
801
  devSettings, m_jsMessageThread.Load(), std::move(preparedScriptStore));
@@ -785,17 +807,7 @@ void ReactInstanceWin::InitializeWithBridge() noexcept {
785
807
  case JSIEngine::V8:
786
808
  #if defined(USE_V8)
787
809
  {
788
- if (Microsoft::ReactNative::HasPackageIdentity()) {
789
- preparedScriptStore =
790
- std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(getApplicationTempFolder());
791
- } else {
792
- wchar_t tempPath[MAX_PATH];
793
- if (GetTempPathW(static_cast<DWORD>(std::size(tempPath)), tempPath)) {
794
- preparedScriptStore =
795
- std::make_unique<facebook::react::BasePreparedScriptStoreImpl>(winrt::to_string(tempPath));
796
- }
797
- }
798
-
810
+ preparedScriptStore = CreatePreparedScriptStore();
799
811
  bool enableMultiThreadSupport{false};
800
812
  #ifdef USE_FABRIC
801
813
  enableMultiThreadSupport = Microsoft::ReactNative::IsFabricEnabled(m_reactContext->Properties());
@@ -836,12 +848,7 @@ void ReactInstanceWin::InitializeWithBridge() noexcept {
836
848
  // We need to keep the instance wrapper alive as its destruction shuts down the native queue.
837
849
  m_options.TurboModuleProvider->SetReactContext(
838
850
  winrt::make<implementation::ReactContext>(Mso::Copy(m_reactContext)));
839
- auto omitNetCxxPropName = ReactPropertyBagHelper::GetName(nullptr, L"OmitNetworkingCxxModules");
840
- auto omitNetCxxPropValue = m_options.Properties.Get(omitNetCxxPropName);
841
- devSettings->omitNetworkingCxxModules = winrt::unbox_value_or(omitNetCxxPropValue, false);
842
- auto useWebSocketTurboModulePropName = ReactPropertyBagHelper::GetName(nullptr, L"UseWebSocketTurboModule");
843
- auto useWebSocketTurboModulePropValue = m_options.Properties.Get(useWebSocketTurboModulePropName);
844
- devSettings->useWebSocketTurboModule = winrt::unbox_value_or(useWebSocketTurboModulePropValue, false);
851
+
845
852
  auto bundleRootPath = devSettings->bundleRootPath;
846
853
  auto jsiRuntimeHolder = devSettings->jsiRuntimeHolder;
847
854
  auto instanceWrapper = facebook::react::CreateReactInstance(
@@ -59,6 +59,9 @@ namespace Microsoft.ReactNative
59
59
 
60
60
  DOC_STRING("Forward input to the RootView. Only required when not using ContentIslands")
61
61
  Int64 SendMessage(UInt32 Msg, UInt64 WParam, Int64 LParam);
62
+
63
+ void OnMounted();
64
+ void OnUnmounted();
62
65
  }
63
66
  }
64
67
 
@@ -11,4 +11,5 @@
11
11
  <Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.Common.props" />
12
12
  <!-- Fixes NuGet restore issues: -->
13
13
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\NuGet.CSharp.props" />
14
+ <Import Project="$(ReactNativeWindowsDir)\PropertySheets\WinUI.props" />
14
15
  </Project>
@@ -14,5 +14,9 @@
14
14
  <!-- Needed for ucrtbased.dll when running a debug build. -->
15
15
  <SDKReference Include="Microsoft.VCLibs, Version=14.0" Condition="'$(Configuration)' == 'Debug'" />
16
16
  </ItemGroup>
17
+
18
+ <ItemGroup Condition="'$(UseExperimentalNuget)' == 'true'">
19
+ <PackageReference Include="$(WinUIPackageName)" Version="$(WinUIPackageVersion)" Condition="'$(OverrideWinUIPackage)'!='true'" />
20
+ </ItemGroup>
17
21
 
18
22
  </Project>
@@ -5,8 +5,18 @@
5
5
  -->
6
6
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
7
7
  <!-- Only include Microsoft.ReactNative.* NuGet packages that C++ (app and lib) projects need when using UseExperimentalNuget. -->
8
- <ItemGroup>
9
- <PackageReference Include="Microsoft.ReactNative" Version="$(ReactNativeWindowsVersion)" />
10
- <PackageReference Include="Microsoft.ReactNative.Cxx" Version="$(ReactNativeWindowsVersion)" />
11
- </ItemGroup>
8
+ <Choose>
9
+ <When Condition="'$(UseFabric)' == 'true'">
10
+ <ItemGroup>
11
+ <PackageReference Include="Microsoft.ReactNative" Version="$(ReactNativeWindowsVersion)-Fabric" />
12
+ <PackageReference Include="Microsoft.ReactNative.Cxx" Version="$(ReactNativeWindowsVersion)-Fabric" />
13
+ </ItemGroup>
14
+ </When>
15
+ <Otherwise>
16
+ <ItemGroup>
17
+ <PackageReference Include="Microsoft.ReactNative" Version="$(ReactNativeWindowsVersion)" />
18
+ <PackageReference Include="Microsoft.ReactNative.Cxx" Version="$(ReactNativeWindowsVersion)" />
19
+ </ItemGroup>
20
+ </Otherwise>
21
+ </Choose>
12
22
  </Project>
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.75.0</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.75.2</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>75</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>2</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>ba3dd8c01553d45225124eaab38a13d8aa0b8b20</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>37b826a56a76f188c8e9d717f386f787b9b8515a</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -7,7 +7,7 @@
7
7
  For local testing of internal versions, modify the WinUI3Version, and comment out the addition nuget source in NuGet.Config
8
8
  -->
9
9
  <!-- This value is also used by the CLI, see /packages/@react-native-windows/generate-windows -->
10
- <WinUI3Version Condition="'$(WinUI3Version)'=='' AND '$(UseExperimentalWinUI3)'=='true'">1.5.240124002-experimental2</WinUI3Version>
10
+ <WinUI3Version Condition="'$(WinUI3Version)'=='' AND '$(UseExperimentalWinUI3)'=='true'">1.6.240701003-experimental2</WinUI3Version>
11
11
  <WinUI3Version Condition="'$(WinUI3Version)'==''">1.5.240227000</WinUI3Version>
12
12
  </PropertyGroup>
13
13