[0.76] Cleanup ReactNativeAppBuilder and ReactNativeWin32App #14025
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR backports #13983 to 0.76.
Description
This PR simplifies and scopes down the API for
ReactNativeAppBuilder
andReactNativeWin32App
.Type of Change
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:
ReactInstanceSettingsBuilder
deleted: 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
'sReactInstanceSettings
with a new one is what caused the bug in When Using New App Template (with ReactNativeAppBuilder) In-App Defined Native Modules Are Not Automatically Registered #13946 in the first placeReactNativeAppBuilder
now 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 aReactNativeWin32App
with those types properly pre-madeReactNativeWin32App::Start()
is now more responsible for the stitching together all of the relevant types to make a working Win32 fabric appReactNativeAppBuilder
to get aReactNativeWin32
app with the base WinAppSDK types readyReactInstanceSettings
and theAppWindow
)app.Start()
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
Microsoft Reviewers: Open in CodeFlow