Best way to use a Win32 API #13908
-
If you have a React Native Windows UWP app and suddenly find that you need to access Win32 APIs, what's the best solution? Back in 2021, Microsoft recommended integrating a Win32 process into the UWP app, but nowadays would init-windows with the new Win32-based cpp-app template be the preferred approach? And if the latter, does it matter whether Fabric is enabled or disabled? CC @jonthysell and @acoates-ms, who seem to have committed frequently to the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
With the new architecture we are going to be moving React Native Windows away from UWP to be a Win32 process on top of WindowsAppSDK. Given that, depending on the size of the app and state of it, I'd probably look into hosting your existing old architecture RN within a Win32 app using Xaml Islands. The ReactRootView control is a standard WinUI 2 Xaml control so you can host it inside a Win32 HWND using the above Xaml hosting. That way your app will already be a win32 app when it comes time to move to the new architecture, and you can use all the Win32 APIs. |
Beta Was this translation helpful? Give feedback.
With the new architecture we are going to be moving React Native Windows away from UWP to be a Win32 process on top of WindowsAppSDK. Given that, depending on the size of the app and state of it, I'd probably look into hosting your existing old architecture RN within a Win32 app using Xaml Islands.
https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/xaml-islands/using-the-xaml-hosting-api
The ReactRootView control is a standard WinUI 2 Xaml control so you can host it inside a Win32 HWND using the above Xaml hosting. That way your app will already be a win32 app when it comes time to move to the new architecture, and you can use all the Win32 APIs.