feat(Windows): Windows support! (#1220)

This commit is contained in:
Kai Guo
2020-03-16 19:30:25 -07:00
committed by GitHub
parent 86c44588f8
commit ffee0d4362
51 changed files with 13079 additions and 10190 deletions
+47
View File
@@ -0,0 +1,47 @@
#include "pch.h"
#include "App.h"
#include "ReactPackageProvider.h"
#include "winrt/ReactNativeWebView.h"
using namespace winrt::WebViewWindows;
using namespace winrt::WebViewWindows::implementation;
/// <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
{
MainComponentName(L"example");
#if BUNDLE
JavaScriptBundleFile(L"index.windows");
InstanceSettings().UseWebDebugger(false);
InstanceSettings().UseLiveReload(false);
#else
JavaScriptMainModuleName(L"example/index");
InstanceSettings().UseWebDebugger(true);
InstanceSettings().UseLiveReload(true);
#endif
#if _DEBUG
InstanceSettings().EnableDeveloperMenu(true);
#else
InstanceSettings().EnableDeveloperMenu(false);
#endif
PackageProviders().Append(make<ReactPackageProvider>()); // Includes all modules in this project
PackageProviders().Append(winrt::ReactNativeWebView::ReactPackageProvider());
InitializeComponent();
// This works around a cpp/winrt bug with composable/aggregable types tracked
// by 22116519
AddRef();
m_inner.as<::IUnknown>()->Release();
}