react-native-windows
react-native-windows copied to clipboard
Cleanup ReactNativeAppBuilder and ReactNativeWin32App
Description
This PR simplifies and scopes down the API for ReactNativeAppBuilder and ReactNativeWin32App.
Type of Change
- Bug fix (non-breaking change which fixes an issue)
Why
ReactNativeAppBuilder's API surface made it too easy to call incorrectly and not realize it.
Resolves #13946
What
There are a variety of changes to the API surface:
-
ReactInstanceSettingsBuilderdeleted: not only are there are simply too many APIs that would need to be exposed to be useful, the very act of creating and replacing the app'sReactNativeHost'sReactInstanceSettingswith a new one is what caused the bug in #13946 in the first place -
ReactNativeAppBuildernow only exposes APIs to specify the intial, non-ReactNative, WinAppSDK types, (i.e.DispatcherQueueController,Compositor, andAppWindow), objects the app developer may already have created for their existing app, and otherwise is only responsible for building aReactNativeWin32Appwith those types properly pre-made -
ReactNativeWin32App::Start()is now more responsible for the stitching together all of the relevant types to make a working Win32 fabric app - All WinRT APIs without an immediate use-case have been commented out until we are sure they are necessary and that it is safe to expose them
- The template has been updated to follow the pattern of:
- Use
ReactNativeAppBuilderto get aReactNativeWin32app with the base WinAppSDK types ready - Get and modify the types as necessary from the created app object (like the
ReactInstanceSettingsand theAppWindow) - Call
app.Start()
- Use
Screenshots
N/A
Testing
Verified new apps and example apps in libraryes build and run properly.
Changelog
Should this change be included in the release notes: yes
Cleanup ReactNativeAppBuilder and ReactNativeWin32App