react-native-windows 0.75.9 → 0.75.10

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 (49) hide show
  1. package/Microsoft.ReactNative/CompositionComponentView.idl +2 -1
  2. package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.cpp +4 -1
  3. package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +1 -1
  4. package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +7 -0
  5. package/Microsoft.ReactNative/Fabric/AbiViewProps.h +2 -0
  6. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +19 -4
  7. package/Microsoft.ReactNative/Fabric/ComponentView.h +8 -3
  8. package/Microsoft.ReactNative/Fabric/Composition/BorderPrimitive.cpp +931 -0
  9. package/Microsoft.ReactNative/Fabric/Composition/BorderPrimitive.h +80 -0
  10. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +31 -13
  11. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +27 -3
  12. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +3 -1
  13. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +8 -32
  14. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +302 -895
  15. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +26 -26
  16. package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +1 -1
  17. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +130 -122
  18. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +14 -8
  19. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +34 -20
  20. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +5 -3
  21. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +63 -2
  22. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -0
  23. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +51 -3
  24. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +3 -0
  25. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +18 -8
  26. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +3 -0
  27. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +46 -4
  28. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +5 -0
  29. package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +9 -3
  30. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +11 -0
  31. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +2 -0
  32. package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +1 -1
  33. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +1 -0
  34. package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +1 -1
  35. package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +25 -129
  36. package/Microsoft.ReactNative/ReactNativeAppBuilder.h +5 -13
  37. package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +13 -34
  38. package/Microsoft.ReactNative/ReactNativeIsland.idl +3 -2
  39. package/Microsoft.ReactNative/ReactNativeWin32App.cpp +129 -18
  40. package/Microsoft.ReactNative/ReactNativeWin32App.h +14 -5
  41. package/Microsoft.ReactNative/ViewProps.idl +2 -0
  42. package/Microsoft.ReactNative.Cxx/ComponentView.Experimental.interop.h +14 -0
  43. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  44. package/Shared/Shared.vcxitems +3 -10
  45. package/Shared/Shared.vcxitems.filters +1 -0
  46. package/package.json +3 -3
  47. package/templates/cpp-app/windows/MyApp/MyApp.cpp +46 -130
  48. package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.cpp +0 -59
  49. package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.h +0 -23
@@ -331,6 +331,7 @@
331
331
  <ClCompile Include="$(MSBuildThisFileDirectory)Networking\NetworkPropertyIds.cpp" />
332
332
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiEventEmitter.cpp" />
333
333
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\TooltipService.cpp" />
334
+ <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\BorderPrimitive.cpp" />
334
335
  </ItemGroup>
335
336
  <ItemGroup>
336
337
  <Filter Include="Source Files">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.75.9",
3
+ "version": "0.75.10",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "@react-native-community/cli": "14.1.0",
27
27
  "@react-native-community/cli-platform-android": "14.1.0",
28
28
  "@react-native-community/cli-platform-ios": "14.1.0",
29
- "@react-native-windows/cli": "0.75.6",
29
+ "@react-native-windows/cli": "0.75.7",
30
30
  "@react-native/assets": "1.0.0",
31
31
  "@react-native/assets-registry": "0.75.3",
32
32
  "@react-native/codegen": "0.75.3",
@@ -67,7 +67,7 @@
67
67
  "yargs": "^17.6.2"
68
68
  },
69
69
  "devDependencies": {
70
- "@react-native-windows/codegen": "0.75.4",
70
+ "@react-native-windows/codegen": "0.75.5",
71
71
  "@react-native/metro-config": "0.75.3",
72
72
  "@rnw-scripts/babel-react-native-config": "0.0.0",
73
73
  "@rnw-scripts/eslint-config": "1.2.23",
@@ -8,6 +8,7 @@
8
8
 
9
9
  #include "NativeModules.h"
10
10
 
11
+ // A PackageProvider containing any turbo modules you define within this app project
11
12
  struct CompReactPackageProvider
12
13
  : winrt::implements<CompReactPackageProvider, winrt::Microsoft::ReactNative::IReactPackageProvider> {
13
14
  public: // IReactPackageProvider
@@ -16,151 +17,66 @@ struct CompReactPackageProvider
16
17
  }
17
18
  };
18
19
 
19
- // Global Variables:
20
- constexpr PCWSTR windowTitle = L"{{ mainComponentName }}";
21
- constexpr PCWSTR mainComponentName = L"{{ mainComponentName }}";
22
-
23
- float ScaleFactor(HWND hwnd) noexcept {
24
- return GetDpiForWindow(hwnd) / static_cast<float>(USER_DEFAULT_SCREEN_DPI);
25
- }
20
+ // The entry point of the Win32 application
21
+ _Use_decl_annotations_ int CALLBACK WinMain(HINSTANCE instance, HINSTANCE, PSTR /* commandLine */, int showCmd) {
22
+ // Initialize WinRT
23
+ winrt::init_apartment(winrt::apartment_type::single_threaded);
26
24
 
27
- void UpdateRootViewSizeToAppWindow(
28
- winrt::Microsoft::ReactNative::ReactNativeIsland const &rootView,
29
- winrt::Microsoft::UI::Windowing::AppWindow const &window) {
30
- auto hwnd = winrt::Microsoft::UI::GetWindowFromWindowId(window.Id());
31
- auto scaleFactor = ScaleFactor(hwnd);
32
- winrt::Windows::Foundation::Size size{
33
- window.ClientSize().Width / scaleFactor, window.ClientSize().Height / scaleFactor};
34
- // Do not relayout when minimized
35
- if (window.Presenter().as<winrt::Microsoft::UI::Windowing::OverlappedPresenter>().State() !=
36
- winrt::Microsoft::UI::Windowing::OverlappedPresenterState::Minimized) {
37
- winrt::Microsoft::ReactNative::LayoutConstraints constraints;
38
- constraints.LayoutDirection = winrt::Microsoft::ReactNative::LayoutDirection::Undefined;
39
- constraints.MaximumSize = constraints.MinimumSize = size;
40
- rootView.Arrange(constraints, {0,0});
41
- }
42
- }
25
+ // Enable per monitor DPI scaling
26
+ SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
43
27
 
44
- // Create and configure the ReactNativeHost
45
- winrt::Microsoft::ReactNative::ReactNativeHost CreateReactNativeHost(
46
- HWND hwnd,
47
- const winrt::Microsoft::UI::Composition::Compositor &compositor) {
28
+ // Find the path hosting the app exe file
48
29
  WCHAR appDirectory[MAX_PATH];
49
30
  GetModuleFileNameW(NULL, appDirectory, MAX_PATH);
50
31
  PathCchRemoveFileSpec(appDirectory, MAX_PATH);
51
32
 
52
- auto host = winrt::Microsoft::ReactNative::ReactNativeHost();
53
-
54
- // Include any autolinked modules
55
- RegisterAutolinkedNativeModulePackages(host.PackageProviders());
33
+ // Create a ReactNativeWin32App with the ReactNativeAppBuilder
34
+ auto reactNativeWin32App{winrt::Microsoft::ReactNative::ReactNativeAppBuilder().Build()};
56
35
 
57
- host.PackageProviders().Append(winrt::make<CompReactPackageProvider>());
36
+ // Configure the initial InstanceSettings for the app's ReactNativeHost
37
+ auto settings{reactNativeWin32App.ReactNativeHost().InstanceSettings()};
38
+ // Register any autolinked native modules
39
+ RegisterAutolinkedNativeModulePackages(settings.PackageProviders());
40
+ // Register any native modules defined within this app project
41
+ settings.PackageProviders().Append(winrt::make<CompReactPackageProvider>());
58
42
 
59
43
  #if BUNDLE
60
- host.InstanceSettings().JavaScriptBundleFile(L"index.windows");
61
- host.InstanceSettings().BundleRootPath(std::wstring(L"file://").append(appDirectory).append(L"\\Bundle\\").c_str());
62
- host.InstanceSettings().UseFastRefresh(false);
44
+ // Load the JS bundle from a file (not Metro):
45
+ // Set the path (on disk) where the .bundle file is located
46
+ settings.BundleRootPath(std::wstring(L"file://").append(appDirectory).append(L"\\Bundle\\").c_str());
47
+ // Set the name of the bundle file (without the .bundle extension)
48
+ settings.JavaScriptBundleFile(L"index.windows");
49
+ // Disable hot reload
50
+ settings.UseFastRefresh(false);
63
51
  #else
64
- host.InstanceSettings().JavaScriptBundleFile(L"index");
65
- host.InstanceSettings().UseFastRefresh(true);
52
+ // Load the JS bundle from Metro
53
+ settings.JavaScriptBundleFile(L"index");
54
+ // Enable hot reload
55
+ settings.UseFastRefresh(true);
66
56
  #endif
67
-
68
57
  #if _DEBUG
69
- host.InstanceSettings().UseDirectDebugger(true);
70
- host.InstanceSettings().UseDeveloperSupport(true);
58
+ // For Debug builds
59
+ // Enable Direct Debugging of JS
60
+ settings.UseDirectDebugger(true);
61
+ // Enable the Developer Menu
62
+ settings.UseDeveloperSupport(true);
71
63
  #else
72
- host.InstanceSettings().UseDirectDebugger(false);
73
- host.InstanceSettings().UseDeveloperSupport(false);
64
+ // For Release builds:
65
+ // Disable Direct Debugging of JS
66
+ settings.UseDirectDebugger(false);
67
+ // Disable the Developer Menu
68
+ settings.UseDeveloperSupport(false);
74
69
  #endif
75
70
 
76
- winrt::Microsoft::ReactNative::ReactCoreInjection::SetTopLevelWindowId(
77
- host.InstanceSettings().Properties(), reinterpret_cast<uint64_t>(hwnd));
78
-
79
- winrt::Microsoft::ReactNative::Composition::CompositionUIService::SetCompositor(
80
- host.InstanceSettings(), compositor);
81
-
82
- return host;
83
- }
84
-
85
- _Use_decl_annotations_ int CALLBACK WinMain(HINSTANCE instance, HINSTANCE, PSTR /* commandLine */, int showCmd) {
86
- // Initialize WinRT.
87
- winrt::init_apartment(winrt::apartment_type::single_threaded);
88
-
89
- // Enable per monitor DPI scaling
90
- SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
91
-
92
- // Create a DispatcherQueue for this thread. This is needed for Composition, Content, and
93
- // Input APIs.
94
- auto dispatcherQueueController{winrt::Microsoft::UI::Dispatching::DispatcherQueueController::CreateOnCurrentThread()};
95
-
96
- // Create a Compositor for all Content on this thread.
97
- auto compositor{winrt::Microsoft::UI::Composition::Compositor()};
98
-
99
- // Create a top-level window.
100
- auto window = winrt::Microsoft::UI::Windowing::AppWindow::Create();
101
- window.Title(windowTitle);
102
- window.Resize({1000, 1000});
103
- window.Show();
104
- auto hwnd = winrt::Microsoft::UI::GetWindowFromWindowId(window.Id());
105
- auto scaleFactor = ScaleFactor(hwnd);
106
-
107
- auto host = CreateReactNativeHost(hwnd, compositor);
108
-
109
- // Start the react-native instance, which will create a JavaScript runtime and load the applications bundle
110
- host.ReloadInstance();
111
-
112
- // Create a RootView which will present a react-native component
113
- winrt::Microsoft::ReactNative::ReactViewOptions viewOptions;
114
- viewOptions.ComponentName(mainComponentName);
115
- auto rootView = winrt::Microsoft::ReactNative::ReactNativeIsland(compositor);
116
- rootView.ReactViewHost(winrt::Microsoft::ReactNative::ReactCoreInjection::MakeViewHost(host, viewOptions));
117
-
118
- // Update the size of the RootView when the AppWindow changes size
119
- window.Changed([wkRootView = winrt::make_weak(rootView)](
120
- winrt::Microsoft::UI::Windowing::AppWindow const &window,
121
- winrt::Microsoft::UI::Windowing::AppWindowChangedEventArgs const &args) {
122
- if (args.DidSizeChange() || args.DidVisibilityChange()) {
123
- if (auto rootView = wkRootView.get()) {
124
- UpdateRootViewSizeToAppWindow(rootView, window);
125
- }
126
- }
127
- });
128
-
129
- // Quit application when main window is closed
130
- window.Destroying(
131
- [host](winrt::Microsoft::UI::Windowing::AppWindow const &window, winrt::IInspectable const & /*args*/) {
132
- // Before we shutdown the application - unload the ReactNativeHost to give the javascript a chance to save any
133
- // state
134
- auto async = host.UnloadInstance();
135
- async.Completed([host](auto asyncInfo, winrt::Windows::Foundation::AsyncStatus asyncStatus) {
136
- assert(asyncStatus == winrt::Windows::Foundation::AsyncStatus::Completed);
137
- host.InstanceSettings().UIDispatcher().Post([]() { PostQuitMessage(0); });
138
- });
139
- });
140
-
141
- // DesktopChildSiteBridge create a ContentSite that can host the RootView ContentIsland
142
- auto bridge = winrt::Microsoft::UI::Content::DesktopChildSiteBridge::Create(compositor, window.Id());
143
- bridge.Connect(rootView.Island());
144
- bridge.ResizePolicy(winrt::Microsoft::UI::Content::ContentSizePolicy::ResizeContentToParentWindow);
145
-
146
- rootView.ScaleFactor(scaleFactor);
147
-
148
- // Set the intialSize of the root view
149
- UpdateRootViewSizeToAppWindow(rootView, window);
150
-
151
- bridge.Show();
152
-
153
- // Run the main application event loop
154
- dispatcherQueueController.DispatcherQueue().RunEventLoop();
155
-
156
- // Rundown the DispatcherQueue. This drains the queue and raises events to let components
157
- // know the message loop has finished.
158
- dispatcherQueueController.ShutdownQueue();
71
+ // Get the AppWindow so we can configure its initial title and size
72
+ auto appWindow{reactNativeWin32App.AppWindow()};
73
+ appWindow.Title(L"{{ mainComponentName }}");
74
+ appWindow.Resize({1000, 1000});
159
75
 
160
- bridge.Close();
161
- bridge = nullptr;
76
+ // Get the ReactViewOptions so we can set the initial RN component to load
77
+ auto viewOptions{reactNativeWin32App.ReactViewOptions()};
78
+ viewOptions.ComponentName(L"{{ mainComponentName }}");
162
79
 
163
- // Destroy all Composition objects
164
- compositor.Close();
165
- compositor = nullptr;
80
+ // Start the app
81
+ reactNativeWin32App.Start();
166
82
  }
@@ -1,59 +0,0 @@
1
- #include "pch.h"
2
- #include "ReactInstanceSettingsBuilder.h"
3
- #include "ReactInstanceSettingsBuilder.g.cpp"
4
- #include "ReactInstanceSettings.h"
5
-
6
- namespace winrt::ReactNative {
7
- using namespace winrt::Microsoft::ReactNative;
8
- }
9
-
10
- namespace winrt::UI {
11
- using namespace winrt::Microsoft::UI;
12
- }
13
-
14
- namespace winrt::Microsoft::ReactNative::implementation {
15
- ReactInstanceSettingsBuilder::ReactInstanceSettingsBuilder() {
16
- m_reactInstanceSettings = winrt::make<winrt::ReactNative::implementation::ReactInstanceSettings>();
17
- }
18
-
19
- winrt::ReactNative::ReactInstanceSettings ReactInstanceSettingsBuilder::ReactInstanceSettings() {
20
- return m_reactInstanceSettings;
21
- }
22
-
23
- winrt::ReactNative::ReactInstanceSettingsBuilder ReactInstanceSettingsBuilder::UseDirectDebugger(bool const &state) {
24
- m_reactInstanceSettings.UseDirectDebugger(state);
25
-
26
- return *this;
27
- }
28
-
29
- winrt::ReactNative::ReactInstanceSettingsBuilder ReactInstanceSettingsBuilder::UseDeveloperSupport(bool const &state) {
30
- m_reactInstanceSettings.UseDeveloperSupport(state);
31
-
32
- return *this;
33
- }
34
-
35
- winrt::ReactNative::ReactInstanceSettingsBuilder ReactInstanceSettingsBuilder::BundleRootPath(hstring const &path) {
36
- m_reactInstanceSettings.BundleRootPath(std::wstring(L"file://").append(path.c_str()).append(L"\\Bundle\\").c_str());
37
-
38
- return *this;
39
- }
40
-
41
- winrt::ReactNative::ReactInstanceSettingsBuilder ReactInstanceSettingsBuilder::DebugBundlePath(hstring const &path) {
42
- m_reactInstanceSettings.DebugBundlePath(path.c_str());
43
-
44
- return *this;
45
- }
46
-
47
- winrt::ReactNative::ReactInstanceSettingsBuilder ReactInstanceSettingsBuilder::JavaScriptBundleFile(
48
- hstring const &file) {
49
- m_reactInstanceSettings.JavaScriptBundleFile(file.c_str());
50
-
51
- return *this;
52
- }
53
-
54
- winrt::ReactNative::ReactInstanceSettingsBuilder ReactInstanceSettingsBuilder::UseFastRefresh(bool const &state) {
55
- m_reactInstanceSettings.UseFastRefresh(state);
56
-
57
- return *this;
58
- }
59
- } // namespace winrt::Microsoft::ReactNative::implementation
@@ -1,23 +0,0 @@
1
- #pragma once
2
- #include "ReactInstanceSettingsBuilder.g.h"
3
-
4
- namespace winrt::Microsoft::ReactNative::implementation {
5
- struct ReactInstanceSettingsBuilder : ReactInstanceSettingsBuilderT<ReactInstanceSettingsBuilder> {
6
- ReactInstanceSettingsBuilder();
7
-
8
- winrt::Microsoft::ReactNative::ReactInstanceSettings ReactInstanceSettings();
9
- winrt::Microsoft::ReactNative::ReactInstanceSettingsBuilder UseDirectDebugger(bool const &state);
10
- winrt::Microsoft::ReactNative::ReactInstanceSettingsBuilder UseDeveloperSupport(bool const &state);
11
- winrt::Microsoft::ReactNative::ReactInstanceSettingsBuilder BundleRootPath(hstring const &path);
12
- winrt::Microsoft::ReactNative::ReactInstanceSettingsBuilder DebugBundlePath(hstring const &path);
13
- winrt::Microsoft::ReactNative::ReactInstanceSettingsBuilder JavaScriptBundleFile(hstring const &file);
14
- winrt::Microsoft::ReactNative::ReactInstanceSettingsBuilder UseFastRefresh(bool const &state);
15
-
16
- private:
17
- winrt::Microsoft::ReactNative::ReactInstanceSettings m_reactInstanceSettings{nullptr};
18
- };
19
- } // namespace winrt::Microsoft::ReactNative::implementation
20
- namespace winrt::Microsoft::ReactNative::factory_implementation {
21
- struct ReactInstanceSettingsBuilder
22
- : ReactInstanceSettingsBuilderT<ReactInstanceSettingsBuilder, implementation::ReactInstanceSettingsBuilder> {};
23
- } // namespace winrt::Microsoft::ReactNative::factory_implementation