diff --git a/apps/PerfCompare/.gitignore b/apps/PerfCompare/.gitignore new file mode 100644 index 00000000000..49b29852fd7 --- /dev/null +++ b/apps/PerfCompare/.gitignore @@ -0,0 +1,3 @@ +# Don't commit bundles +*ReactAssets* +*Bundle* \ No newline at end of file diff --git a/apps/PerfCompare/PerfCompare/MainPage.xaml.cs b/apps/PerfCompare/PerfCompare/MainPage.xaml.cs index 591f86fdc18..46c9e6499cb 100644 --- a/apps/PerfCompare/PerfCompare/MainPage.xaml.cs +++ b/apps/PerfCompare/PerfCompare/MainPage.xaml.cs @@ -29,7 +29,7 @@ private void Button_Click(object sender, RoutedEventArgs e) } else if (sender == rnwcppBtn) { - + rootFrame.Navigate(typeof(ReactNativeVNextPage)); } } } diff --git a/apps/PerfCompare/PerfCompare/PerfCompare.csproj b/apps/PerfCompare/PerfCompare/PerfCompare.csproj index e160b251b7f..198c72e1371 100644 --- a/apps/PerfCompare/PerfCompare/PerfCompare.csproj +++ b/apps/PerfCompare/PerfCompare/PerfCompare.csproj @@ -113,12 +113,16 @@ ReactNativeCurrentPage.xaml + + ReactNativeVNextPage.xaml + Designer + @@ -138,6 +142,9 @@ PreserveNewest + + PreserveNewest + @@ -156,6 +163,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + diff --git a/apps/PerfCompare/PerfCompare/ReactNativeVNextPage.xaml b/apps/PerfCompare/PerfCompare/ReactNativeVNextPage.xaml new file mode 100644 index 00000000000..d0923fd4136 --- /dev/null +++ b/apps/PerfCompare/PerfCompare/ReactNativeVNextPage.xaml @@ -0,0 +1,17 @@ + + + + + + + diff --git a/apps/PerfCompare/PerfCompare/ReactNativeVNextPage.xaml.cs b/apps/PerfCompare/PerfCompare/ReactNativeVNextPage.xaml.cs new file mode 100644 index 00000000000..1553a900ae2 --- /dev/null +++ b/apps/PerfCompare/PerfCompare/ReactNativeVNextPage.xaml.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +using react.uwp; + +namespace PerfCompare +{ + public sealed partial class ReactNativeVNextPage : Page + { + private IInstance _instance; + + const string JSFILENAME = "index.uwp"; + const string JSCOMPONENTNAME = "PerfCompareRN"; + + public ReactNativeVNextPage() + { + this.InitializeComponent(); + LoadReact(); + } + + private void LoadReact() + { + _instance = Instance.Create(JSFILENAME); + + _instance.Start(new InstanceSettings() + { + UseWebDebugger = false, + UseLiveReload = false, + }); + + RootElement.Instance = _instance; + RootElement.InitialProps = "{}"; + RootElement.JsComponentName = JSCOMPONENTNAME; + + RootElement.StartRender(); + } + + private async void Page_Loaded(object sender, RoutedEventArgs e) + { + await Dispatcher.RunIdleAsync((args) => + { + App.PerfStats.Stop(); + App.ShowStats(); + }); + } + } +} diff --git a/apps/PerfCompare/PerfCompare/bundle.cmd b/apps/PerfCompare/PerfCompare/bundle.cmd index a5069ecaff9..3b7bbe0497d 100644 --- a/apps/PerfCompare/PerfCompare/bundle.cmd +++ b/apps/PerfCompare/PerfCompare/bundle.cmd @@ -4,8 +4,10 @@ setlocal set AppName=PerfCompareRN set AppRoot=%~dp0 + +echo Building index.windows.bundle + set CurrentRoot=%AppRoot%..\..\..\current -set VNextRoot=%AppRoot%..\..\..\current pushd %CurrentRoot% @@ -22,4 +24,23 @@ rmdir /s /q %AppName% popd +echo Building index.uwp.bundle + +set VNextRoot=%AppRoot%..\..\..\vnext + +pushd %VNextRoot% + +rmdir /s /q %AppName% +mkdir %AppName% + +xcopy /q %AppRoot%images\* %AppName%\images\ +xcopy /q %AppRoot%app.json %AppName%\ +xcopy /q %AppRoot%index.js %AppName%\ + +call react-native bundle --platform uwp --entry-file %AppName%\index.js --bundle-output %AppRoot%Bundle\index.uwp.bundle --assets-dest %AppRoot%Bundle + +rmdir /s /q %AppName% + +popd + endlocal