-
Notifications
You must be signed in to change notification settings - Fork 68
Add uwp packaging logic #142
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
91 commits
Select commit
Hold shift + click to select a range
3256064
setup react windows project
6e55b8c
start on cmake definition for babylon react native for uwp
1e96682
cache some helper logic
0c3b117
change setup to x64 for local testing
7cb9a19
add source files
f8cb2b1
add some needed files
e5c243c
working winrt plugin initialization
5500b7d
more windows work
740cdd1
complete merge
6e0642b
failing during linker
f46a5d4
add options to vcxproj to try and unblock debug builds
ba04d8d
move to use jsi
321625f
fix modules
6d7eec3
add react-native-windows dependency
344aa12
merge master
0c3cbd6
working compilation
2d9ef2d
current state
5e18391
current proto changes
4c5778f
working native input compilation
f0bed54
fix playground solution
d98762d
close to working
fd3335e
working windows logic
c28b098
hacked app setup to support working windows logic
07b127f
working vr
9ac1c23
move BabylonNative dll definition and add arm64 support
0fe138a
fix babylonnative to build in module folder
b8c0384
fix submodule declarations
7962233
remove unneeded build scripts
0d7e725
add clean solution
4adc50c
working build
caa66e4
working build
8498e69
typescript content needs cleaned up
a6c8486
things need cleaned up but we will try a clean repo
4abc4f8
fix package.json definition
ba05041
remove debug logic
09b0090
get metro to play nice with new exclusion list
9b012f2
add x86, arm build support
6055788
revert files
6339293
packages working
ce79ce9
complete merge
d3d9413
add reset function and allow babylonnative to build from modules folder
910f79f
fix package path resolution for react native windows
e2b0e98
prepare for draft review
1b7f62a
comment out slider, needs work to fix
fd740a8
move to newest babylonnative and fix gitmodule repo
4442fac
remove unneeded package-lock
2aeeb7f
remove untrue comments
37f80fe
remove unneeded comments
8e92ef3
fix namespace comment names
e2e5086
avoid checking in bin log
d89f4e0
revert unneeded metro.config.js changes
0300c5d
get npm install working vs using yarn
1ae6ee7
get project to work with npm install
efa7fb4
add readme tips
130874b
fix permissions and slider initialization issues
cd326b3
add step value to fix windows slider usage
af82b5a
rename babylon native component to avoid lib collisions
a775a06
rename to BabylonReactNative
72606db
complete merge
af5f0b6
ready for review
90daed8
update build steps
d6050ba
cleanup some unneeded changes
1a33cf9
avoid moving to new commit
ecc21cb
add event revokers
98e1d5d
add uwp build logic
5585d9f
revert settings file
6d9b1bb
Merge branch 'uwpPackage' into uwp
0dc287a
remove files and update documentation
3f2a26b
address review comments
466f94d
address more review comments
874dbc3
Update Modules/@babylonjs/react-native/EngineHook.ts
chrisfromwork 3ec80d2
address review comments
910c952
Merge branch 'uwp' of https://github.com/chrisfromwork/BabylonReactNa…
465d9c3
move hmd render behaviors to enginehook
336535f
remove unneeded dev dependencies
874fa7f
move engine logic into engineview
78b388a
Update Modules/@babylonjs/react-native/EngineHook.ts
chrisfromwork 3f1ccf2
working windows packaging
d731115
avoid combining gulp files
4515879
address review comments
d211e8f
remove unneeded reference
6501196
Merge branch 'uwp' into uwpPackage
02dc933
update vcxproj and package choices
f7711af
remove additional solution to prevent react-native-windows version co…
fd09fd5
remove unneeded solution and update module
01818b6
merge master branch
0674b86
packages appear ready for usage
61cbfa2
clean up things for review
113a360
execute file copies in parallel
9874ec3
revert unneeded changes
7223a9e
revert settings file
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
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 |
|---|---|---|
|
|
@@ -61,3 +61,6 @@ buck-out/ | |
|
|
||
| # CocoaPods | ||
| /ios/Pods/ | ||
|
|
||
| deploy.binlog | ||
| msbuild.binlog | ||
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,92 @@ | ||
| *AppPackages* | ||
| *BundleArtifacts* | ||
|
|
||
| #OS junk files | ||
| [Tt]humbs.db | ||
| *.DS_Store | ||
|
|
||
| #Visual Studio files | ||
| *.[Oo]bj | ||
| *.user | ||
| *.aps | ||
| *.pch | ||
| *.vspscc | ||
| *.vssscc | ||
| *_i.c | ||
| *_p.c | ||
| *.ncb | ||
| *.suo | ||
| *.tlb | ||
| *.tlh | ||
| *.bak | ||
| *.[Cc]ache | ||
| *.ilk | ||
| *.log | ||
| *.lib | ||
| *.sbr | ||
| *.sdf | ||
| *.opensdf | ||
| *.opendb | ||
| *.unsuccessfulbuild | ||
| ipch/ | ||
| [Oo]bj/ | ||
| [Bb]in | ||
| [Dd]ebug*/ | ||
| [Rr]elease*/ | ||
| Ankh.NoLoad | ||
|
|
||
| # Visual C++ cache files | ||
| ipch/ | ||
| *.aps | ||
| *.ncb | ||
| *.opendb | ||
| *.opensdf | ||
| *.sdf | ||
| *.cachefile | ||
| *.VC.db | ||
| *.VC.VC.opendb | ||
|
|
||
| #MonoDevelop | ||
| *.pidb | ||
| *.userprefs | ||
|
|
||
| #Tooling | ||
| _ReSharper*/ | ||
| *.resharper | ||
| [Tt]est[Rr]esult* | ||
| *.sass-cache | ||
|
|
||
| #Project files | ||
| [Bb]uild/ | ||
|
|
||
| #Subversion files | ||
| .svn | ||
|
|
||
| # Office Temp Files | ||
| ~$* | ||
|
|
||
| # vim Temp Files | ||
| *~ | ||
|
|
||
| #NuGet | ||
| packages/ | ||
| *.nupkg | ||
|
|
||
| #ncrunch | ||
| *ncrunch* | ||
| *crunch*.local.xml | ||
|
|
||
| # visual studio database projects | ||
| *.dbmdl | ||
|
|
||
| #Test files | ||
| *.testsettings | ||
|
|
||
| #Other files | ||
| *.DotSettings | ||
| .vs/ | ||
| *project.lock.json | ||
|
|
||
| #Files generated by the VS build | ||
| **/Generated Files/** | ||
|
|
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,10 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
|
||
| <!-- Flags can be added here to effect the compilation of Microsoft.ReactNative --> | ||
| <PropertyGroup Label="Microsoft.ReactNative Build Flags"> | ||
| <UseWinUI3>false</UseWinUI3> | ||
| <UseHermes>false</UseHermes> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> |
Large diffs are not rendered by default.
Oops, something went wrong.
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 @@ | ||
| /Bundle |
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,79 @@ | ||
| #include "pch.h" | ||
|
|
||
| #include "App.h" | ||
|
|
||
| #include "AutolinkedNativeModules.g.h" | ||
| #include "ReactPackageProvider.h" | ||
|
|
||
| using namespace winrt::PackageTest; | ||
| using namespace winrt::PackageTest::implementation; | ||
| using namespace winrt; | ||
| using namespace Windows::UI::Xaml; | ||
| using namespace Windows::UI::Xaml::Controls; | ||
| using namespace Windows::UI::Xaml::Navigation; | ||
| using namespace Windows::ApplicationModel; | ||
|
|
||
| /// <summary> | ||
| /// Initializes the singleton application object. This is the first line of | ||
| /// authored code executed, and as such is the logical equivalent of main() or | ||
| /// WinMain(). | ||
| /// </summary> | ||
| App::App() noexcept | ||
| { | ||
| #if BUNDLE | ||
| JavaScriptBundleFile(L"index.windows"); | ||
| InstanceSettings().UseWebDebugger(false); | ||
| InstanceSettings().UseFastRefresh(false); | ||
| #else | ||
| JavaScriptBundleFile(L"index"); | ||
| InstanceSettings().UseWebDebugger(true); | ||
| InstanceSettings().UseFastRefresh(true); | ||
| #endif | ||
|
|
||
| #if _DEBUG | ||
| InstanceSettings().UseDeveloperSupport(true); | ||
| #else | ||
| InstanceSettings().UseDeveloperSupport(false); | ||
| #endif | ||
|
|
||
| RegisterAutolinkedNativeModulePackages(PackageProviders()); // Includes any autolinked modules | ||
|
|
||
| PackageProviders().Append(make<ReactPackageProvider>()); // Includes all modules in this project | ||
|
|
||
| InitializeComponent(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Invoked when the application is launched normally by the end user. Other entry points | ||
| /// will be used such as when the application is launched to open a specific file. | ||
| /// </summary> | ||
| /// <param name="e">Details about the launch request and process.</param> | ||
| void App::OnLaunched(activation::LaunchActivatedEventArgs const& e) | ||
| { | ||
| super::OnLaunched(e); | ||
|
|
||
| Frame rootFrame = Window::Current().Content().as<Frame>(); | ||
| rootFrame.Navigate(xaml_typename<PackageTest::MainPage>(), box_value(e.Arguments())); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Invoked when application execution is being suspended. Application state is saved | ||
| /// without knowing whether the application will be terminated or resumed with the contents | ||
| /// of memory still intact. | ||
| /// </summary> | ||
| /// <param name="sender">The source of the suspend request.</param> | ||
| /// <param name="e">Details about the suspend request.</param> | ||
| void App::OnSuspending([[maybe_unused]] IInspectable const& sender, [[maybe_unused]] SuspendingEventArgs const& e) | ||
| { | ||
| // Save application state and stop any background activity | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Invoked when Navigation to a certain page fails | ||
| /// </summary> | ||
| /// <param name="sender">The Frame which failed navigation</param> | ||
| /// <param name="e">Details about the navigation failure</param> | ||
| void App::OnNavigationFailed(IInspectable const&, NavigationFailedEventArgs const& e) | ||
| { | ||
| throw hresult_error(E_FAIL, hstring(L"Failed to load Page ") + e.SourcePageType().Name); | ||
| } |
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,18 @@ | ||
| #pragma once | ||
|
|
||
| #include "App.xaml.g.h" | ||
|
|
||
| namespace activation = winrt::Windows::ApplicationModel::Activation; | ||
|
|
||
| namespace winrt::PackageTest::implementation | ||
| { | ||
| struct App : AppT<App> | ||
| { | ||
| App() noexcept; | ||
| void OnLaunched(activation::LaunchActivatedEventArgs const&); | ||
| void OnSuspending(IInspectable const&, Windows::ApplicationModel::SuspendingEventArgs const&); | ||
| void OnNavigationFailed(IInspectable const&, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs const&); | ||
| private: | ||
| using super = AppT<App>; | ||
| }; | ||
| } // namespace winrt::PackageTest::implementation |
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,3 @@ | ||
| namespace PackageTest | ||
| { | ||
| } |
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,10 @@ | ||
| <react:ReactApplication | ||
| x:Class="PackageTest.App" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:local="using:PackageTest" | ||
| xmlns:react="using:Microsoft.ReactNative"> | ||
| <Application.Resources> | ||
| <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" /> | ||
| </Application.Resources> | ||
| </react:ReactApplication> |
Binary file added
BIN
+1.4 KB
Apps/PackageTest/windows/PackageTest/Assets/LockScreenLogo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.52 KB
Apps/PackageTest/windows/PackageTest/Assets/SplashScreen.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.87 KB
Apps/PackageTest/windows/PackageTest/Assets/Square150x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.61 KB
Apps/PackageTest/windows/PackageTest/Assets/Square44x44Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.23 KB
...t/windows/PackageTest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.13 KB
Apps/PackageTest/windows/PackageTest/Assets/Wide310x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
Apps/PackageTest/windows/PackageTest/AutolinkedNativeModules.g.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,23 @@ | ||
| // AutolinkedNativeModules.g.cpp contents generated by "react-native autolink-windows" | ||
| // clang-format off | ||
| #include "pch.h" | ||
| #include "AutolinkedNativeModules.g.h" | ||
|
|
||
| // Includes from @babylonjs/react-native | ||
| #include <winrt/BabylonReactNative.h> | ||
|
|
||
| // Includes from react-native-permissions | ||
| #include <winrt/RNPermissions.h> | ||
|
|
||
| namespace winrt::Microsoft::ReactNative | ||
| { | ||
|
|
||
| void RegisterAutolinkedNativeModulePackages(winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::ReactNative::IReactPackageProvider> const& packageProviders) | ||
| { | ||
| // IReactPackageProviders from @babylonjs/react-native | ||
| packageProviders.Append(winrt::BabylonReactNative::ReactPackageProvider()); | ||
| // IReactPackageProviders from react-native-permissions | ||
| packageProviders.Append(winrt::RNPermissions::ReactPackageProvider()); | ||
| } | ||
|
|
||
| } |
10 changes: 10 additions & 0 deletions
10
Apps/PackageTest/windows/PackageTest/AutolinkedNativeModules.g.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,10 @@ | ||
| // AutolinkedNativeModules.g.h contents generated by "react-native autolink-windows" | ||
| // clang-format off | ||
| #pragma once | ||
|
|
||
| namespace winrt::Microsoft::ReactNative | ||
| { | ||
|
|
||
| void RegisterAutolinkedNativeModulePackages(winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::ReactNative::IReactPackageProvider> const& packageProviders); | ||
|
|
||
| } |
6 changes: 6 additions & 0 deletions
6
Apps/PackageTest/windows/PackageTest/AutolinkedNativeModules.g.props
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,6 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <!-- AutolinkedNativeModules.g.props contents generated by "react-native autolink-windows" --> | ||
| <PropertyGroup> | ||
| </PropertyGroup> | ||
| </Project> |
14 changes: 14 additions & 0 deletions
14
Apps/PackageTest/windows/PackageTest/AutolinkedNativeModules.g.targets
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,14 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <!-- AutolinkedNativeModules.g.targets contents generated by "react-native autolink-windows" --> | ||
| <ItemGroup> | ||
| <!-- Projects from @babylonjs/react-native --> | ||
| <ProjectReference Include="$(ProjectDir)..\..\node_modules\@babylonjs\react-native\windows\BabylonReactNative\BabylonReactNative.vcxproj"> | ||
| <Project>{240FBB7A-EC3B-43E4-B4D8-16C7C092D192}</Project> | ||
| </ProjectReference> | ||
| <!-- Projects from react-native-permissions --> | ||
| <ProjectReference Include="$(ProjectDir)..\..\node_modules\react-native-permissions\windows\RNPermissions\RNPermissions.vcxproj"> | ||
| <Project>{99677b9d-a27b-4239-930e-c36c8d339c54}</Project> | ||
| </ProjectReference> | ||
| </ItemGroup> | ||
| </Project> |
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 @@ | ||
| #include "pch.h" | ||
| #include "MainPage.h" | ||
| #if __has_include("MainPage.g.cpp") | ||
| #include "MainPage.g.cpp" | ||
| #endif | ||
|
|
||
| #include "App.h" | ||
|
|
||
| using namespace winrt; | ||
| using namespace Windows::UI::Xaml; | ||
|
|
||
| namespace winrt::PackageTest::implementation | ||
| { | ||
| MainPage::MainPage() | ||
| { | ||
| InitializeComponent(); | ||
| auto app = Application::Current().as<App>(); | ||
| ReactRootView().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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #pragma once | ||
| #include "MainPage.g.h" | ||
| #include <winrt/Microsoft.ReactNative.h> | ||
|
|
||
| namespace winrt::PackageTest::implementation | ||
| { | ||
| struct MainPage : MainPageT<MainPage> | ||
| { | ||
| MainPage(); | ||
| }; | ||
| } | ||
|
|
||
| namespace winrt::PackageTest::factory_implementation | ||
| { | ||
| struct MainPage : MainPageT<MainPage, implementation::MainPage> | ||
| { | ||
| }; | ||
| } | ||
|
|
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.
So at this point, any consumer of the NPM package will additionally need to make these changes to their
metro.config.js?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.
react-native-windows on setup overwrites this file to contain this logic, and when other custom things are in this file it doesn't seem to merge them. If there are thoughts on how things could be improved, we should relay this feedback to the react-native-windows team.
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.
Yea that's pretty bad. I guess their assumption is that people will diff the file and manually fix it up. One thing that would help would be to put this logic in a separate file that is bundled with RNW and import it into this file. That might be good feedback for the rnw folks.