-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ReactApplication should not impose a ReactRootView #4949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
b7a0b4a
set up react application to use an app's reactrootview
asklar c313c61
more demo
asklar 7f245ba
Change files
asklar be19f9a
format
asklar 0ffc3f8
remove MainComponent and add MainPage to cs template
asklar 1f665c6
cpp template
asklar b490e0f
template updates
asklar 13b8554
format
asklar 158de63
template
asklar 969e425
format
asklar 3068fae
namespace
asklar 7fc2e4a
cs
asklar fd08fbe
cs using
asklar d8dd382
cs using 2
asklar b47d266
cs xaml
asklar bb132ae
sample apps
asklar 4307acd
sample cpp
asklar 9fd27c9
format
asklar 82824c5
size message
asklar 9d98e08
size exception, 4619 is fixed
asklar ad718c8
run_wdio msg
asklar 8d0d4d0
wdio failed tests msg
asklar 10e75fb
clean up e2e app xaml
asklar ffe4ed8
move playground to use ReactApplication
asklar 4f40a5f
win32 playground
asklar 5d21138
revert sampleApps change since 4982 will fix that, some PR feedback
asklar 0563111
global replace . for :: for cpp namespaces
asklar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
change/react-native-windows-2020-05-19-03-08-41-reactApplication.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "type": "prerelease", | ||
| "comment": "set up react application to use an app's reactrootview", | ||
| "packageName": "react-native-windows", | ||
| "email": "asklar@microsoft.com", | ||
| "dependentChangeType": "patch", | ||
| "date": "2020-05-19T10:08:41.333Z" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <Page | ||
| x:Class="ReactUWPTestApp.MainPage" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:local="using:ReactUWPTestApp" | ||
| xmlns:react="using:Microsoft.ReactNative" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| mc:Ignorable="d" | ||
| Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
| <react:ReactRootView x:Name="myRootView" ComponentName="ReactUWPTestApp" | ||
| Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Height="500"/> | ||
| </Page> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using Windows.UI.Xaml; | ||
| using Windows.UI.Xaml.Controls; | ||
|
|
||
| // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 | ||
|
|
||
| namespace ReactUWPTestApp | ||
| { | ||
| /// <summary> | ||
| /// An empty page that can be used on its own or navigated to within a Frame. | ||
| /// </summary> | ||
| public sealed partial class MainPage : Page | ||
| { | ||
| public MainPage() | ||
| { | ||
| this.InitializeComponent(); | ||
| var app = Application.Current as App; | ||
| myRootView.ReactNativeHost = app.Host; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/MainPage.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #include "pch.h" | ||
| #include "MainPage.h" | ||
| #if __has_include("MainPage.g.cpp") | ||
| #include "MainPage.g.cpp" | ||
| #endif | ||
|
|
||
| #include <App.h> | ||
| #include <winrt/Microsoft.ReactNative.h> | ||
|
|
||
| using namespace winrt; | ||
| using namespace Windows::UI::Xaml; | ||
|
|
||
| namespace winrt::SampleAppCpp::implementation { | ||
| MainPage::MainPage() { | ||
| InitializeComponent(); | ||
| ReactRootView().ReactNativeHost(Application::Current().as<App>()->Host()); | ||
| } | ||
|
|
||
| } // namespace winrt::SampleAppCpp::implementation |
13 changes: 13 additions & 0 deletions
13
packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/MainPage.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #pragma once | ||
|
|
||
| #include "MainPage.g.h" | ||
|
|
||
| namespace winrt::SampleAppCpp::implementation { | ||
| struct MainPage : MainPageT<MainPage> { | ||
| MainPage(); | ||
| }; | ||
| } // namespace winrt::SampleAppCpp::implementation | ||
|
|
||
| namespace winrt::SampleAppCpp::factory_implementation { | ||
| struct MainPage : MainPageT<MainPage, implementation::MainPage> {}; | ||
| } // namespace winrt::SampleAppCpp::factory_implementation |
8 changes: 8 additions & 0 deletions
8
packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/MainPage.idl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| namespace SampleAppCpp | ||
| { | ||
| [default_interface] | ||
| runtimeclass MainPage : Windows.UI.Xaml.Controls.Page | ||
| { | ||
| MainPage(); | ||
| } | ||
| } |
12 changes: 12 additions & 0 deletions
12
packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/MainPage.xaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <Page | ||
| x:Class="SampleAppCpp.MainPage" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:local="using:SampleAppCpp" | ||
| xmlns:react="using:Microsoft.ReactNative" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| mc:Ignorable="d"> | ||
|
|
||
| <react:ReactRootView x:Name="ReactRootView" ComponentName="SampleApp" /> | ||
| </Page> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/microsoft-reactnative-sampleapps/windows/SampleAppCS/MainPage.xaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <Page | ||
| x:Class="SampleAppCS.MainPage" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:local="using:SampleAppCS" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| mc:Ignorable="d" | ||
| xmlns:react="using:Microsoft.ReactNative" | ||
| Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
|
|
||
| <react:ReactRootView x:Name="ReactRootView" ComponentName="SampleApp"/> | ||
| </Page> |
31 changes: 31 additions & 0 deletions
31
packages/microsoft-reactnative-sampleapps/windows/SampleAppCS/MainPage.xaml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.IO; | ||
| using System.Linq; | ||
| using System.Runtime.InteropServices.WindowsRuntime; | ||
| using Windows.Foundation; | ||
| using Windows.Foundation.Collections; | ||
| using Windows.UI.Xaml; | ||
| using Windows.UI.Xaml.Controls; | ||
| using Windows.UI.Xaml.Controls.Primitives; | ||
| using Windows.UI.Xaml.Data; | ||
| using Windows.UI.Xaml.Input; | ||
| using Windows.UI.Xaml.Media; | ||
| using Windows.UI.Xaml.Navigation; | ||
|
|
||
| // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 | ||
|
|
||
| namespace SampleAppCS | ||
| { | ||
| /// <summary> | ||
| /// An empty page that can be used on its own or navigated to within a Frame. | ||
| /// </summary> | ||
| public sealed partial class MainPage : Page | ||
| { | ||
| public MainPage() | ||
| { | ||
| this.InitializeComponent(); | ||
| ReactRootView.ReactNativeHost = (Application.Current as App).Host; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider console.error and using Chalk to set a color.