react-native-windows 0.81.4 → 0.81.5

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 (61) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/Libraries/NativeComponent/ViewConfigIgnore.windows.js +45 -0
  3. package/Libraries/Renderer/implementations/ReactFabric-dev.js +38 -35
  4. package/Libraries/Renderer/implementations/ReactFabric-prod.js +51 -22
  5. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +54 -24
  6. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +36 -33
  7. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5 -5
  8. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5 -5
  9. package/Libraries/Renderer/shims/ReactNativeTypes.js +23 -11
  10. package/Libraries/Renderer/shims/ReactNativeTypes.windows.js +23 -12
  11. package/Microsoft.ReactNative/ComponentView.idl +2 -0
  12. package/Microsoft.ReactNative/Composition.Input.idl +7 -0
  13. package/Microsoft.ReactNative/CompositionComponentView.idl +5 -0
  14. package/Microsoft.ReactNative/CompositionHwndHost.idl +1 -0
  15. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +19 -1
  16. package/Microsoft.ReactNative/Fabric/ComponentView.h +10 -1
  17. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +12 -0
  18. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +15 -0
  19. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +75 -0
  20. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -0
  21. package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +10 -45
  22. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +86 -98
  23. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +4 -0
  24. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +80 -48
  25. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +11 -3
  26. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +61 -74
  27. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +4 -3
  28. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +2 -1
  29. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeWindow.cpp +245 -0
  30. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeWindow.h +80 -0
  31. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +33 -1
  32. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +17 -0
  33. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +47 -23
  34. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +3 -0
  35. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +3 -1
  36. package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +20 -95
  37. package/Microsoft.ReactNative/Modules/LogBoxModule.h +1 -1
  38. package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +0 -41
  39. package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +0 -11
  40. package/Microsoft.ReactNative/ReactNativeIsland.idl +2 -3
  41. package/Microsoft.ReactNative/ReactNativeWin32App.cpp +31 -101
  42. package/Microsoft.ReactNative/ReactNativeWin32App.h +2 -13
  43. package/Microsoft.ReactNative/ReactNativeWindow.idl +44 -0
  44. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  45. package/Shared/Shared.vcxitems +7 -0
  46. package/Shared/Shared.vcxitems.filters +6 -0
  47. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +2 -1
  48. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +26 -9
  49. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +2 -1
  50. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +2 -1
  51. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +8 -3
  52. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +8 -3
  53. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +1 -0
  54. package/codegen/react/components/rnwcore/InputAccessory.g.h +2 -1
  55. package/codegen/react/components/rnwcore/ModalHostView.g.h +26 -9
  56. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +8 -3
  57. package/codegen/react/components/rnwcore/SafeAreaView.g.h +1 -0
  58. package/codegen/react/components/rnwcore/Switch.g.h +8 -3
  59. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +2 -1
  60. package/codegen/react/components/rnwcore/VirtualView.g.h +8 -3
  61. package/package.json +21 -21
@@ -15,34 +15,10 @@
15
15
  #include "winrt/Microsoft.UI.Interop.h"
16
16
  #include "winrt/Microsoft.UI.Windowing.h"
17
17
 
18
- // Scaling factor for the window's content based on the DPI of the display where the window is located.
19
- float ScaleFactor(HWND hwnd) noexcept {
20
- return GetDpiForWindow(hwnd) / static_cast<float>(USER_DEFAULT_SCREEN_DPI);
21
- }
22
-
23
- void UpdateRootViewSizeToAppWindow(
24
- winrt::Microsoft::ReactNative::ReactNativeIsland const &rootView,
25
- winrt::Microsoft::UI::Windowing::AppWindow const &window) {
26
- auto hwnd = winrt::Microsoft::UI::GetWindowFromWindowId(window.Id());
27
- auto scaleFactor = ScaleFactor(hwnd);
28
- winrt::Windows::Foundation::Size size{
29
- window.ClientSize().Width / scaleFactor, window.ClientSize().Height / scaleFactor};
30
- // Do not relayout when minimized
31
- if (window.Presenter().as<winrt::Microsoft::UI::Windowing::OverlappedPresenter>().State() !=
32
- winrt::Microsoft::UI::Windowing::OverlappedPresenterState::Minimized) {
33
- winrt::Microsoft::ReactNative::LayoutConstraints constraints;
34
- constraints.LayoutDirection = winrt::Microsoft::ReactNative::LayoutDirection::Undefined;
35
- constraints.MaximumSize = constraints.MinimumSize = size;
36
- rootView.Arrange(constraints, {0, 0});
37
- }
38
- }
39
-
40
18
  namespace winrt::Microsoft::ReactNative::implementation {
41
19
  ReactNativeWin32App::ReactNativeWin32App() {}
42
20
 
43
21
  ReactNativeWin32App::~ReactNativeWin32App() {
44
- m_desktopChildSiteBridge = nullptr;
45
-
46
22
  // Destroy all Composition objects
47
23
  if (m_compositor != nullptr) {
48
24
  m_compositor.Close();
@@ -51,7 +27,7 @@ ReactNativeWin32App::~ReactNativeWin32App() {
51
27
  }
52
28
 
53
29
  winrt::Microsoft::UI::Windowing::AppWindow ReactNativeWin32App::AppWindow() {
54
- return m_appWindow;
30
+ return ReactNativeWindow().AppWindow();
55
31
  }
56
32
 
57
33
  void ReactNativeWin32App::AppWindow(winrt::Microsoft::UI::Windowing::AppWindow const &appWindow) {
@@ -59,29 +35,19 @@ void ReactNativeWin32App::AppWindow(winrt::Microsoft::UI::Windowing::AppWindow c
59
35
  }
60
36
 
61
37
  winrt::Microsoft::UI::Composition::Compositor ReactNativeWin32App::Compositor() {
62
- return m_compositor;
63
- }
64
-
65
- void ReactNativeWin32App::Compositor(winrt::Microsoft::UI::Composition::Compositor const &compositor) {
66
- m_compositor = compositor;
67
- }
68
-
69
- void ReactNativeWin32App::DesktopChildSiteBridge(
70
- winrt::Microsoft::UI::Content::DesktopChildSiteBridge const &desktopChildSiteBridge) {
71
- m_desktopChildSiteBridge = desktopChildSiteBridge;
72
- }
73
-
74
- winrt::Microsoft::UI::Content::DesktopChildSiteBridge ReactNativeWin32App::DesktopChildSiteBridge() {
75
- return m_desktopChildSiteBridge;
76
- }
38
+ if (m_compositor == nullptr) {
39
+ // Create a DispatcherQueue for this thread. This is needed for Composition, Content, and Input APIs.
40
+ m_dispatcherQueueController = winrt::Microsoft::UI::Dispatching::DispatcherQueueController::CreateOnCurrentThread();
77
41
 
78
- winrt::Microsoft::UI::Dispatching::DispatcherQueueController ReactNativeWin32App::DispatcherQueueController() {
79
- return m_dispatcherQueueController;
80
- }
42
+ // Currently set the property to use current thread dispatcher as a default UI dispatcher.
43
+ ReactNativeHost().InstanceSettings().Properties().Set(
44
+ ReactDispatcherHelper::UIDispatcherProperty(), ReactDispatcherHelper::UIThreadDispatcher());
81
45
 
82
- void ReactNativeWin32App::DispatcherQueueController(
83
- winrt::Microsoft::UI::Dispatching::DispatcherQueueController const &dispatcherQueueController) {
84
- m_dispatcherQueueController = dispatcherQueueController;
46
+ m_compositor = winrt::Microsoft::UI::Composition::Compositor();
47
+ winrt::Microsoft::ReactNative::Composition::CompositionUIService::SetCompositor(
48
+ ReactNativeHost().InstanceSettings(), m_compositor);
49
+ }
50
+ return m_compositor;
85
51
  }
86
52
 
87
53
  winrt::Microsoft::ReactNative::ReactNativeHost ReactNativeWin32App::ReactNativeHost() {
@@ -91,18 +57,6 @@ winrt::Microsoft::ReactNative::ReactNativeHost ReactNativeWin32App::ReactNativeH
91
57
  return m_host;
92
58
  }
93
59
 
94
- void ReactNativeWin32App::ReactNativeHost(winrt::Microsoft::ReactNative::ReactNativeHost const &host) {
95
- m_host = host;
96
- }
97
-
98
- winrt::Microsoft::ReactNative::ReactNativeIsland ReactNativeWin32App::ReactNativeIsland() {
99
- return m_reactNativeIsland;
100
- }
101
-
102
- void ReactNativeWin32App::ReactNativeIsland(winrt::Microsoft::ReactNative::ReactNativeIsland const &reactNativeIsland) {
103
- m_reactNativeIsland = reactNativeIsland;
104
- }
105
-
106
60
  winrt::Microsoft::ReactNative::ReactViewOptions ReactNativeWin32App::ReactViewOptions() {
107
61
  if (m_reactViewOptions == nullptr) {
108
62
  m_reactViewOptions = winrt::make<winrt::Microsoft::ReactNative::implementation::ReactViewOptions>();
@@ -114,45 +68,36 @@ void ReactNativeWin32App::ReactViewOptions(winrt::Microsoft::ReactNative::ReactV
114
68
  m_reactViewOptions = viewOptions;
115
69
  }
116
70
 
71
+ winrt::Microsoft::ReactNative::ReactNativeWindow ReactNativeWin32App::ReactNativeWindow() noexcept {
72
+ if (!m_rnWindow) {
73
+ if (m_appWindow) {
74
+ m_rnWindow = winrt::Microsoft::ReactNative::ReactNativeWindow::CreateFromWindow(m_appWindow, Compositor());
75
+ } else {
76
+ m_rnWindow = winrt::Microsoft::ReactNative::ReactNativeWindow::CreateFromCompositor(Compositor());
77
+ m_appWindow = m_rnWindow.AppWindow();
78
+ m_appWindow.Title(L"ReactNativeWin32App");
79
+ m_appWindow.Resize({1000, 1000});
80
+ }
81
+ }
82
+
83
+ return m_rnWindow;
84
+ }
85
+
117
86
  void ReactNativeWin32App::Start() {
118
87
  // Show the hosting AppWindow
119
- m_appWindow.Show();
120
-
121
- // Currently set the property to use current thread dispatcher as a default UI dispatcher.
122
- // TODO: Use the correct dispatcher from a developer-provided DispatcherQueueController
123
- ReactNativeHost().InstanceSettings().Properties().Set(
124
- ReactDispatcherHelper::UIDispatcherProperty(), ReactDispatcherHelper::UIThreadDispatcher());
88
+ AppWindow().Show();
125
89
 
126
90
  auto hwnd{winrt::Microsoft::UI::GetWindowFromWindowId(m_appWindow.Id())};
127
91
 
128
92
  winrt::Microsoft::ReactNative::ReactCoreInjection::SetTopLevelWindowId(
129
93
  ReactNativeHost().InstanceSettings().Properties(), reinterpret_cast<uint64_t>(hwnd));
130
94
 
131
- winrt::Microsoft::ReactNative::Composition::CompositionUIService::SetCompositor(
132
- ReactNativeHost().InstanceSettings(), m_compositor);
133
-
134
95
  // Start the react-native instance, which will create a JavaScript runtime and load the applications bundle.
135
96
  ReactNativeHost().ReloadInstance();
136
97
 
137
- // Create a RootView which will present a react-native component
138
- if (m_reactNativeIsland == nullptr) {
139
- m_reactNativeIsland = winrt::Microsoft::ReactNative::ReactNativeIsland(m_compositor);
140
- }
141
-
142
- m_reactNativeIsland.ReactViewHost(
98
+ m_rnWindow.ReactNativeIsland().ReactViewHost(
143
99
  winrt::Microsoft::ReactNative::ReactCoreInjection::MakeViewHost(ReactNativeHost(), ReactViewOptions()));
144
100
 
145
- // Update the size of the RootView when the AppWindow changes size
146
- m_appWindow.Changed([wkRootView = winrt::make_weak(m_reactNativeIsland)](
147
- winrt::Microsoft::UI::Windowing::AppWindow const &window,
148
- winrt::Microsoft::UI::Windowing::AppWindowChangedEventArgs const &args) {
149
- if (args.DidSizeChange() || args.DidVisibilityChange()) {
150
- if (auto rootView = wkRootView.get()) {
151
- UpdateRootViewSizeToAppWindow(rootView, window);
152
- }
153
- }
154
- });
155
-
156
101
  // Quit application when main window is closed
157
102
  m_appWindow.Destroying([this](
158
103
  winrt::Microsoft::UI::Windowing::AppWindow const &window,
@@ -166,28 +111,13 @@ void ReactNativeWin32App::Start() {
166
111
  });
167
112
  });
168
113
 
169
- // DesktopChildSiteBridge create a ContentSite that can host the RootView ContentIsland
170
- m_desktopChildSiteBridge =
171
- winrt::Microsoft::UI::Content::DesktopChildSiteBridge::Create(m_compositor, m_appWindow.Id());
172
-
173
- m_desktopChildSiteBridge.Connect(m_reactNativeIsland.Island());
174
-
175
- m_desktopChildSiteBridge.ResizePolicy(winrt::Microsoft::UI::Content::ContentSizePolicy::ResizeContentToParentWindow);
176
-
177
- auto scaleFactor = ScaleFactor(hwnd);
178
- m_reactNativeIsland.ScaleFactor(scaleFactor);
179
-
180
- UpdateRootViewSizeToAppWindow(m_reactNativeIsland, m_appWindow);
181
-
182
- m_desktopChildSiteBridge.Show();
183
-
184
114
  // Run the main application event loop
185
115
  m_dispatcherQueueController.DispatcherQueue().RunEventLoop();
186
116
 
117
+ m_appWindow.Destroy();
118
+
187
119
  // Rundown the DispatcherQueue. This drains the queue and raises events to let components
188
120
  // know the message loop has finished.
189
121
  m_dispatcherQueueController.ShutdownQueue();
190
-
191
- m_desktopChildSiteBridge.Close();
192
122
  }
193
123
  } // namespace winrt::Microsoft::ReactNative::implementation
@@ -15,20 +15,10 @@ struct ReactNativeWin32App : ReactNativeWin32AppT<ReactNativeWin32App> {
15
15
  winrt::Microsoft::UI::Windowing::AppWindow AppWindow();
16
16
 
17
17
  winrt::Microsoft::UI::Composition::Compositor Compositor();
18
- void Compositor(winrt::Microsoft::UI::Composition::Compositor const &compositor);
19
-
20
- winrt::Microsoft::UI::Content::DesktopChildSiteBridge DesktopChildSiteBridge();
21
- void DesktopChildSiteBridge(winrt::Microsoft::UI::Content::DesktopChildSiteBridge const &desktopChildSiteBridge);
22
-
23
- winrt::Microsoft::UI::Dispatching::DispatcherQueueController DispatcherQueueController();
24
- void DispatcherQueueController(
25
- winrt::Microsoft::UI::Dispatching::DispatcherQueueController const &dispatcherQueueController);
26
18
 
27
19
  winrt::Microsoft::ReactNative::ReactNativeHost ReactNativeHost();
28
- void ReactNativeHost(winrt::Microsoft::ReactNative::ReactNativeHost const &host);
29
20
 
30
- winrt::Microsoft::ReactNative::ReactNativeIsland ReactNativeIsland();
31
- void ReactNativeIsland(winrt::Microsoft::ReactNative::ReactNativeIsland const &reactNativeIsland);
21
+ winrt::Microsoft::ReactNative::ReactNativeWindow ReactNativeWindow() noexcept;
32
22
 
33
23
  winrt::Microsoft::ReactNative::ReactViewOptions ReactViewOptions();
34
24
  void ReactViewOptions(winrt::Microsoft::ReactNative::ReactViewOptions const &reactViewOptions);
@@ -36,12 +26,11 @@ struct ReactNativeWin32App : ReactNativeWin32AppT<ReactNativeWin32App> {
36
26
  void Start();
37
27
 
38
28
  private:
29
+ winrt::Microsoft::ReactNative::ReactNativeWindow m_rnWindow{nullptr};
39
30
  winrt::Microsoft::UI::Windowing::AppWindow m_appWindow{nullptr};
40
31
  winrt::Microsoft::UI::Composition::Compositor m_compositor{nullptr};
41
- winrt::Microsoft::UI::Content::DesktopChildSiteBridge m_desktopChildSiteBridge{nullptr};
42
32
  winrt::Microsoft::UI::Dispatching::DispatcherQueueController m_dispatcherQueueController{nullptr};
43
33
  winrt::Microsoft::ReactNative::ReactNativeHost m_host{nullptr};
44
- winrt::Microsoft::ReactNative::ReactNativeIsland m_reactNativeIsland{nullptr};
45
34
  winrt::Microsoft::ReactNative::ReactViewOptions m_reactViewOptions{nullptr};
46
35
  };
47
36
  } // namespace winrt::Microsoft::ReactNative::implementation
@@ -0,0 +1,44 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ import "ReactNativeIsland.idl";
5
+
6
+ #include "NamespaceRedirect.h"
7
+ #include "DocString.h"
8
+
9
+ namespace Microsoft.ReactNative
10
+ {
11
+
12
+ [experimental]
13
+ enum ContentSizePolicy
14
+ {
15
+ None,
16
+ ResizeContentToParentWindow,
17
+ ResizeParentWindowToContent,
18
+ };
19
+
20
+ [default_interface]
21
+ [webhosthidden]
22
+ [experimental]
23
+ DOC_STRING("Simplifies hosting a ReactNativeIsland inside a Window.")
24
+ runtimeclass ReactNativeWindow : Windows.Foundation.IClosable
25
+ {
26
+ static ReactNativeWindow CreateFromCompositor(Microsoft.UI.Composition.Compositor compositor);
27
+ static ReactNativeWindow CreateFromWindow(Microsoft.UI.Windowing.AppWindow appWindow, Microsoft.UI.Composition.Compositor compositor);
28
+ static ReactNativeWindow CreateFromContentSiteBridgeAndIsland(Microsoft.UI.Content.IContentSiteBridge bridge, Microsoft.ReactNative.ReactNativeIsland island);
29
+ static ReactNativeWindow CreateFromWindowAndIsland(Microsoft.UI.Windowing.AppWindow appWindow, Microsoft.ReactNative.ReactNativeIsland island);
30
+
31
+ ReactNativeIsland ReactNativeIsland { get; };
32
+
33
+ Microsoft.UI.Windowing.AppWindow AppWindow { get; };
34
+
35
+ Microsoft.UI.Content.IContentSiteBridge ContentSiteBridge { get; };
36
+ ContentSizePolicy ResizePolicy { get; set; };
37
+
38
+ DOC_STRING("When the ResizePolicy is set to ResizeParentWindowToContent, these LayoutConstraints will control the layout of the content."
39
+ " When ResizePolicy is set to ResizeContentToParentWindow, these constraints will be ignored. Instead the window can be constrained using"
40
+ " OverlappedPresenter.PreferredMaximumHeight etc.")
41
+ LayoutConstraints LayoutConstraints { get; set; };
42
+ }
43
+
44
+ } // namespace Microsoft.ReactNative
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.81.4</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.81.5</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>81</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>4</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>5</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>6cfb66be9b4dbbdff53e896e215230cdeddc38a6</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>ff246e07a1fca3e9925f60981d8a9b9d75ceb87d</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -85,6 +85,11 @@
85
85
  <DependentUpon>$(ReactNativeWindowsDir)Microsoft.ReactNative\ReactNativeIsland.idl</DependentUpon>
86
86
  <SubType>Code</SubType>
87
87
  </ClCompile>
88
+ <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\ReactNativeWindow.cpp">
89
+ <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
90
+ <DependentUpon>$(ReactNativeWindowsDir)Microsoft.ReactNative\ReactNativeWindow.idl</DependentUpon>
91
+ <SubType>Code</SubType>
92
+ </ClCompile>
88
93
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\CompositionUIService.cpp">
89
94
  <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
90
95
  <DependentUpon>$(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionUIService.idl</DependentUpon>
@@ -315,6 +320,7 @@
315
320
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\CompositionRootAutomationProvider.h" />
316
321
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\CompositionDynamicAutomationProvider.h" />
317
322
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\ReactNativeIsland.h" />
323
+ <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\ReactNativeWindow.h" />
318
324
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\CompositionUIService.h" />
319
325
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\CompositionViewComponentView.h" />
320
326
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\ImageComponentView.h" />
@@ -710,6 +716,7 @@
710
716
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionContext.idl" />
711
717
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionHwndHost.idl" />
712
718
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\ReactNativeIsland.idl" />
719
+ <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\ReactNativeWindow.idl" />
713
720
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionSwitcher.idl" />
714
721
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionUIService.idl" />
715
722
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\IReactCompositionViewComponentBuilder.idl" />
@@ -204,6 +204,9 @@
204
204
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\ReactNativeIsland.cpp">
205
205
  <Filter>Source Files\Fabric\Composition</Filter>
206
206
  </ClCompile>
207
+ <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\ReactNativeWindow.cpp">
208
+ <Filter>Source Files\Fabric\Composition</Filter>
209
+ </ClCompile>
207
210
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\CompositionUIService.cpp">
208
211
  <Filter>Source Files\Fabric\Composition</Filter>
209
212
  </ClCompile>
@@ -754,6 +757,9 @@
754
757
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\ReactNativeIsland.h">
755
758
  <Filter>Header Files\Fabric\Composition</Filter>
756
759
  </ClInclude>
760
+ <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\ReactNativeWindow.h">
761
+ <Filter>Header Files\Fabric\Composition</Filter>
762
+ </ClInclude>
757
763
  <ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\CompositionUIService.h">
758
764
  <Filter>Header Files\Fabric\Composition</Filter>
759
765
  </ClInclude>
@@ -28,7 +28,8 @@ struct ActivityIndicatorViewProps : winrt::implements<ActivityIndicatorViewProps
28
28
  hidesWhenStopped = cloneFromProps->hidesWhenStopped;
29
29
  animating = cloneFromProps->animating;
30
30
  color = cloneFromProps->color;
31
- size = cloneFromProps->size;
31
+ size = cloneFromProps->size;
32
+
32
33
  }
33
34
  }
34
35
 
@@ -30,7 +30,11 @@ struct AndroidDrawerLayoutProps : winrt::implements<AndroidDrawerLayoutProps, wi
30
30
  drawerPosition = cloneFromProps->drawerPosition;
31
31
  drawerWidth = cloneFromProps->drawerWidth;
32
32
  drawerLockMode = cloneFromProps->drawerLockMode;
33
- statusBarBackgroundColor = cloneFromProps->statusBarBackgroundColor;
33
+ statusBarBackgroundColor = cloneFromProps->statusBarBackgroundColor;
34
+ onDrawerSlide = cloneFromProps->onDrawerSlide;
35
+ onDrawerStateChanged = cloneFromProps->onDrawerStateChanged;
36
+ onDrawerOpen = cloneFromProps->onDrawerOpen;
37
+ onDrawerClose = cloneFromProps->onDrawerClose;
34
38
  }
35
39
  }
36
40
 
@@ -56,6 +60,19 @@ struct AndroidDrawerLayoutProps : winrt::implements<AndroidDrawerLayoutProps, wi
56
60
  REACT_FIELD(statusBarBackgroundColor)
57
61
  winrt::Microsoft::ReactNative::Color statusBarBackgroundColor{nullptr};
58
62
 
63
+ // These fields can be used to determine if JS has registered for this event
64
+ REACT_FIELD(onDrawerSlide)
65
+ bool onDrawerSlide{false};
66
+
67
+ REACT_FIELD(onDrawerStateChanged)
68
+ bool onDrawerStateChanged{false};
69
+
70
+ REACT_FIELD(onDrawerOpen)
71
+ bool onDrawerOpen{false};
72
+
73
+ REACT_FIELD(onDrawerClose)
74
+ bool onDrawerClose{false};
75
+
59
76
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
60
77
  };
61
78
 
@@ -88,26 +105,26 @@ struct AndroidDrawerLayoutEventEmitter {
88
105
  using OnDrawerOpen = AndroidDrawerLayoutSpec_onDrawerOpen;
89
106
  using OnDrawerClose = AndroidDrawerLayoutSpec_onDrawerClose;
90
107
 
91
- void onDrawerSlide(OnDrawerSlide &value) const {
92
- m_eventEmitter.DispatchEvent(L"drawerSlide", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
108
+ void onDrawerSlide(OnDrawerSlide &&value) const {
109
+ m_eventEmitter.DispatchEvent(L"drawerSlide", [value = std::move(value)](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
93
110
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
94
111
  });
95
112
  }
96
113
 
97
- void onDrawerStateChanged(OnDrawerStateChanged &value) const {
98
- m_eventEmitter.DispatchEvent(L"drawerStateChanged", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
114
+ void onDrawerStateChanged(OnDrawerStateChanged &&value) const {
115
+ m_eventEmitter.DispatchEvent(L"drawerStateChanged", [value = std::move(value)](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
99
116
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
100
117
  });
101
118
  }
102
119
 
103
- void onDrawerOpen(OnDrawerOpen &value) const {
104
- m_eventEmitter.DispatchEvent(L"drawerOpen", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
120
+ void onDrawerOpen(OnDrawerOpen &&value) const {
121
+ m_eventEmitter.DispatchEvent(L"drawerOpen", [value = std::move(value)](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
105
122
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
106
123
  });
107
124
  }
108
125
 
109
- void onDrawerClose(OnDrawerClose &value) const {
110
- m_eventEmitter.DispatchEvent(L"drawerClose", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
126
+ void onDrawerClose(OnDrawerClose &&value) const {
127
+ m_eventEmitter.DispatchEvent(L"drawerClose", [value = std::move(value)](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
111
128
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
112
129
  });
113
130
  }
@@ -25,7 +25,8 @@ struct AndroidHorizontalScrollContentViewProps : winrt::implements<AndroidHorizo
25
25
  {
26
26
  if (cloneFrom) {
27
27
  auto cloneFromProps = cloneFrom.as<AndroidHorizontalScrollContentViewProps>();
28
- removeClippedSubviews = cloneFromProps->removeClippedSubviews;
28
+ removeClippedSubviews = cloneFromProps->removeClippedSubviews;
29
+
29
30
  }
30
31
  }
31
32
 
@@ -31,7 +31,8 @@ struct AndroidProgressBarProps : winrt::implements<AndroidProgressBarProps, winr
31
31
  progress = cloneFromProps->progress;
32
32
  animating = cloneFromProps->animating;
33
33
  color = cloneFromProps->color;
34
- testID = cloneFromProps->testID;
34
+ testID = cloneFromProps->testID;
35
+
35
36
  }
36
37
  }
37
38
 
@@ -30,7 +30,8 @@ struct AndroidSwipeRefreshLayoutProps : winrt::implements<AndroidSwipeRefreshLay
30
30
  progressBackgroundColor = cloneFromProps->progressBackgroundColor;
31
31
  size = cloneFromProps->size;
32
32
  progressViewOffset = cloneFromProps->progressViewOffset;
33
- refreshing = cloneFromProps->refreshing;
33
+ refreshing = cloneFromProps->refreshing;
34
+ onRefresh = cloneFromProps->onRefresh;
34
35
  }
35
36
  }
36
37
 
@@ -56,6 +57,10 @@ struct AndroidSwipeRefreshLayoutProps : winrt::implements<AndroidSwipeRefreshLay
56
57
  REACT_FIELD(refreshing)
57
58
  bool refreshing{};
58
59
 
60
+ // These fields can be used to determine if JS has registered for this event
61
+ REACT_FIELD(onRefresh)
62
+ bool onRefresh{false};
63
+
59
64
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
60
65
  };
61
66
 
@@ -69,8 +74,8 @@ struct AndroidSwipeRefreshLayoutEventEmitter {
69
74
 
70
75
  using OnRefresh = AndroidSwipeRefreshLayoutSpec_onRefresh;
71
76
 
72
- void onRefresh(OnRefresh &value) const {
73
- m_eventEmitter.DispatchEvent(L"refresh", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
77
+ void onRefresh(OnRefresh &&value) const {
78
+ m_eventEmitter.DispatchEvent(L"refresh", [value = std::move(value)](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
74
79
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
75
80
  });
76
81
  }
@@ -33,7 +33,8 @@ struct AndroidSwitchProps : winrt::implements<AndroidSwitchProps, winrt::Microso
33
33
  value = cloneFromProps->value;
34
34
  on = cloneFromProps->on;
35
35
  thumbTintColor = cloneFromProps->thumbTintColor;
36
- trackTintColor = cloneFromProps->trackTintColor;
36
+ trackTintColor = cloneFromProps->trackTintColor;
37
+ onChange = cloneFromProps->onChange;
37
38
  }
38
39
  }
39
40
 
@@ -68,6 +69,10 @@ struct AndroidSwitchProps : winrt::implements<AndroidSwitchProps, winrt::Microso
68
69
  REACT_FIELD(trackTintColor)
69
70
  winrt::Microsoft::ReactNative::Color trackTintColor{nullptr};
70
71
 
72
+ // These fields can be used to determine if JS has registered for this event
73
+ REACT_FIELD(onChange)
74
+ bool onChange{false};
75
+
71
76
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
72
77
  };
73
78
 
@@ -86,8 +91,8 @@ struct AndroidSwitchEventEmitter {
86
91
 
87
92
  using OnChange = AndroidSwitchSpec_onChange;
88
93
 
89
- void onChange(OnChange &value) const {
90
- m_eventEmitter.DispatchEvent(L"change", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
94
+ void onChange(OnChange &&value) const {
95
+ m_eventEmitter.DispatchEvent(L"change", [value = std::move(value)](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
91
96
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
92
97
  });
93
98
  }
@@ -25,6 +25,7 @@ struct DebuggingOverlayProps : winrt::implements<DebuggingOverlayProps, winrt::M
25
25
  {
26
26
  if (cloneFrom) {
27
27
  auto cloneFromProps = cloneFrom.as<DebuggingOverlayProps>();
28
+
28
29
 
29
30
  }
30
31
  }
@@ -25,7 +25,8 @@ struct InputAccessoryProps : winrt::implements<InputAccessoryProps, winrt::Micro
25
25
  {
26
26
  if (cloneFrom) {
27
27
  auto cloneFromProps = cloneFrom.as<InputAccessoryProps>();
28
- backgroundColor = cloneFromProps->backgroundColor;
28
+ backgroundColor = cloneFromProps->backgroundColor;
29
+
29
30
  }
30
31
  }
31
32
 
@@ -36,7 +36,11 @@ struct ModalHostViewProps : winrt::implements<ModalHostViewProps, winrt::Microso
36
36
  allowSwipeDismissal = cloneFromProps->allowSwipeDismissal;
37
37
  supportedOrientations = cloneFromProps->supportedOrientations;
38
38
  identifier = cloneFromProps->identifier;
39
- title = cloneFromProps->title;
39
+ title = cloneFromProps->title;
40
+ onRequestClose = cloneFromProps->onRequestClose;
41
+ onShow = cloneFromProps->onShow;
42
+ onDismiss = cloneFromProps->onDismiss;
43
+ onOrientationChange = cloneFromProps->onOrientationChange;
40
44
  }
41
45
  }
42
46
 
@@ -80,6 +84,19 @@ struct ModalHostViewProps : winrt::implements<ModalHostViewProps, winrt::Microso
80
84
  REACT_FIELD(title)
81
85
  std::optional<std::string> title;
82
86
 
87
+ // These fields can be used to determine if JS has registered for this event
88
+ REACT_FIELD(onRequestClose)
89
+ bool onRequestClose{false};
90
+
91
+ REACT_FIELD(onShow)
92
+ bool onShow{false};
93
+
94
+ REACT_FIELD(onDismiss)
95
+ bool onDismiss{false};
96
+
97
+ REACT_FIELD(onOrientationChange)
98
+ bool onOrientationChange{false};
99
+
83
100
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
84
101
  };
85
102
 
@@ -110,26 +127,26 @@ struct ModalHostViewEventEmitter {
110
127
  using OnDismiss = ModalHostViewSpec_onDismiss;
111
128
  using OnOrientationChange = ModalHostViewSpec_onOrientationChange;
112
129
 
113
- void onRequestClose(OnRequestClose &value) const {
114
- m_eventEmitter.DispatchEvent(L"requestClose", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
130
+ void onRequestClose(OnRequestClose &&value) const {
131
+ m_eventEmitter.DispatchEvent(L"requestClose", [value = std::move(value)](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
115
132
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
116
133
  });
117
134
  }
118
135
 
119
- void onShow(OnShow &value) const {
120
- m_eventEmitter.DispatchEvent(L"show", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
136
+ void onShow(OnShow &&value) const {
137
+ m_eventEmitter.DispatchEvent(L"show", [value = std::move(value)](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
121
138
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
122
139
  });
123
140
  }
124
141
 
125
- void onDismiss(OnDismiss &value) const {
126
- m_eventEmitter.DispatchEvent(L"dismiss", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
142
+ void onDismiss(OnDismiss &&value) const {
143
+ m_eventEmitter.DispatchEvent(L"dismiss", [value = std::move(value)](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
127
144
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
128
145
  });
129
146
  }
130
147
 
131
- void onOrientationChange(OnOrientationChange &value) const {
132
- m_eventEmitter.DispatchEvent(L"orientationChange", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
148
+ void onOrientationChange(OnOrientationChange &&value) const {
149
+ m_eventEmitter.DispatchEvent(L"orientationChange", [value = std::move(value)](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
133
150
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
134
151
  });
135
152
  }
@@ -29,7 +29,8 @@ struct PullToRefreshViewProps : winrt::implements<PullToRefreshViewProps, winrt:
29
29
  titleColor = cloneFromProps->titleColor;
30
30
  title = cloneFromProps->title;
31
31
  progressViewOffset = cloneFromProps->progressViewOffset;
32
- refreshing = cloneFromProps->refreshing;
32
+ refreshing = cloneFromProps->refreshing;
33
+ onRefresh = cloneFromProps->onRefresh;
33
34
  }
34
35
  }
35
36
 
@@ -52,6 +53,10 @@ struct PullToRefreshViewProps : winrt::implements<PullToRefreshViewProps, winrt:
52
53
  REACT_FIELD(refreshing)
53
54
  bool refreshing{};
54
55
 
56
+ // These fields can be used to determine if JS has registered for this event
57
+ REACT_FIELD(onRefresh)
58
+ bool onRefresh{false};
59
+
55
60
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
56
61
  };
57
62
 
@@ -65,8 +70,8 @@ struct PullToRefreshViewEventEmitter {
65
70
 
66
71
  using OnRefresh = PullToRefreshViewSpec_onRefresh;
67
72
 
68
- void onRefresh(OnRefresh &value) const {
69
- m_eventEmitter.DispatchEvent(L"refresh", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
73
+ void onRefresh(OnRefresh &&value) const {
74
+ m_eventEmitter.DispatchEvent(L"refresh", [value = std::move(value)](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
70
75
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
71
76
  });
72
77
  }
@@ -25,6 +25,7 @@ struct SafeAreaViewProps : winrt::implements<SafeAreaViewProps, winrt::Microsoft
25
25
  {
26
26
  if (cloneFrom) {
27
27
  auto cloneFromProps = cloneFrom.as<SafeAreaViewProps>();
28
+
28
29
 
29
30
  }
30
31
  }