From b7a0b4a43c19fc13f7459f15133dd99ddf827323 Mon Sep 17 00:00:00 2001 From: Alexander Sklar Date: Tue, 19 May 2020 02:54:03 -0700 Subject: [PATCH 01/27] set up react application to use an app's reactrootview --- .../windows/ReactUWPTestApp/App.xaml.cs | 13 ++++- .../windows/ReactUWPTestApp/MainPage.xaml | 24 ++++++++++ .../windows/ReactUWPTestApp/MainPage.xaml.cs | 34 ++++++++++++++ .../ReactUWPTestApp/ReactUWPTestApp.csproj | 9 ++++ .../ReactApplication.cpp | 47 +++++-------------- .../Microsoft.ReactNative/ReactApplication.h | 3 -- .../ReactApplicationDelegate.cpp | 2 +- .../ReactApplicationDelegate.h | 2 + 8 files changed, 95 insertions(+), 39 deletions(-) create mode 100644 packages/E2ETest/windows/ReactUWPTestApp/MainPage.xaml create mode 100644 packages/E2ETest/windows/ReactUWPTestApp/MainPage.xaml.cs diff --git a/packages/E2ETest/windows/ReactUWPTestApp/App.xaml.cs b/packages/E2ETest/windows/ReactUWPTestApp/App.xaml.cs index 9befe037a84..a0c08cb8ec1 100644 --- a/packages/E2ETest/windows/ReactUWPTestApp/App.xaml.cs +++ b/packages/E2ETest/windows/ReactUWPTestApp/App.xaml.cs @@ -9,6 +9,8 @@ using Windows.UI.Core; using Windows.UI.ViewManagement; using Microsoft.ReactNative.Managed; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; namespace ReactUWPTestApp { @@ -56,11 +58,20 @@ public App() protected override void OnLaunched(LaunchActivatedEventArgs e) { base.OnLaunched(e); + var frame = Window.Current.Content as Frame; + if (frame == null) + { + frame = new Frame(); + Window.Current.Content = frame; + } + frame.Navigate(typeof(MainPage)); + Window.Current.Activate(); + SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; ApplicationView.GetForCurrentView().TryResizeView(new Size(800, 600)); if (DisplayInformation.GetForCurrentView().ResolutionScale != ResolutionScale.Scale100Percent) { - throw new Exception("A bug requires this app to run at 100% for accurate results - See https://github.com/microsoft/react-native-windows/issues/4619"); + //throw new Exception("A bug requires this app to run at 100% for accurate results - See https://github.com/microsoft/react-native-windows/issues/4619"); } } } diff --git a/packages/E2ETest/windows/ReactUWPTestApp/MainPage.xaml b/packages/E2ETest/windows/ReactUWPTestApp/MainPage.xaml new file mode 100644 index 00000000000..e91075fa311 --- /dev/null +++ b/packages/E2ETest/windows/ReactUWPTestApp/MainPage.xaml @@ -0,0 +1,24 @@ + + + + +