diff --git a/change/react-native-windows-2019-12-18-17-43-39-RemoveBridgeNamespace.json b/change/react-native-windows-2019-12-18-17-43-39-RemoveBridgeNamespace.json new file mode 100644 index 00000000000..e6f84b37d70 --- /dev/null +++ b/change/react-native-windows-2019-12-18-17-43-39-RemoveBridgeNamespace.json @@ -0,0 +1,8 @@ +{ + "type": "prerelease", + "comment": "Removed Bridge sub-namespace in favor of Microsoft.ReactNative", + "packageName": "react-native-windows", + "email": "vmorozov@microsoft.com", + "commit": "a547f8926dbcaf3c04b8c7a12c7a1e9b970acd6c", + "date": "2019-12-19T01:43:39.278Z" +} \ No newline at end of file diff --git a/packages/E2ETest/windows/TreeDumpLibrary/ReactPackageProvider.cs b/packages/E2ETest/windows/TreeDumpLibrary/ReactPackageProvider.cs index 54dccd72e3b..30d9991f556 100644 --- a/packages/E2ETest/windows/TreeDumpLibrary/ReactPackageProvider.cs +++ b/packages/E2ETest/windows/TreeDumpLibrary/ReactPackageProvider.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; +using Microsoft.ReactNative; using Microsoft.ReactNative.Managed; namespace TreeDumpLibrary diff --git a/packages/E2ETest/windows/TreeDumpLibrary/TreeDumpControlViewManager.cs b/packages/E2ETest/windows/TreeDumpLibrary/TreeDumpControlViewManager.cs index 5b4d7eb78ef..6cbe1b2ec8d 100644 --- a/packages/E2ETest/windows/TreeDumpLibrary/TreeDumpControlViewManager.cs +++ b/packages/E2ETest/windows/TreeDumpLibrary/TreeDumpControlViewManager.cs @@ -5,8 +5,7 @@ using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Controls; -using Microsoft.ReactNative.Managed; -using Microsoft.ReactNative.Bridge; +using Microsoft.ReactNative; using Windows.UI.Xaml; using Windows.UI.ViewManagement; using System.Threading.Tasks; diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/ReactPackageProvider.cpp b/packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/ReactPackageProvider.cpp index b6ea457b286..79e014da8cc 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/ReactPackageProvider.cpp +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/ReactPackageProvider.cpp @@ -6,7 +6,7 @@ #include "DebugConsole.h" -using namespace winrt::Microsoft::ReactNative::Bridge; +using namespace winrt::Microsoft::ReactNative; namespace winrt::SampleAppCpp::implementation { diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/ReactPackageProvider.h b/packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/ReactPackageProvider.h index 3e24d9aa5d2..637c6ca6ff3 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/ReactPackageProvider.h +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/ReactPackageProvider.h @@ -2,9 +2,9 @@ // Licensed under the MIT License. #pragma once -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" -using namespace winrt::Microsoft::ReactNative::Bridge; +using namespace winrt::Microsoft::ReactNative; namespace winrt::SampleAppCpp::implementation { diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/pch.h b/packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/pch.h index f52c438967d..baa545d38ac 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/pch.h +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleAppCPP/pch.h @@ -18,7 +18,6 @@ #include #include -#include #include #include @@ -30,4 +29,4 @@ #include #include #include -#include \ No newline at end of file +#include diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CircleViewManagerCPP.cpp b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CircleViewManagerCPP.cpp index 3151312c5d4..783f1a66305 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CircleViewManagerCPP.cpp +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CircleViewManagerCPP.cpp @@ -5,7 +5,7 @@ #include "CircleViewManagerCpp.h" using namespace winrt; -using namespace Microsoft::ReactNative::Bridge; +using namespace Microsoft::ReactNative; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CircleViewManagerCPP.h b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CircleViewManagerCPP.h index a7e26089e9f..130ff8fd708 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CircleViewManagerCPP.h +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CircleViewManagerCPP.h @@ -3,14 +3,14 @@ #pragma once -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" namespace winrt::SampleLibraryCpp::implementation { struct CircleViewManagerCpp : winrt::implements< CircleViewManagerCpp, - winrt::Microsoft::ReactNative::Bridge::IViewManager, - winrt::Microsoft::ReactNative::Bridge::IViewManagerWithChildren> { + winrt::Microsoft::ReactNative::IViewManager, + winrt::Microsoft::ReactNative::IViewManagerWithChildren> { public: CircleViewManagerCpp(); diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CustomUserControlViewManagerCPP.cpp b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CustomUserControlViewManagerCPP.cpp index 7a40ea29927..3b65b8de346 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CustomUserControlViewManagerCPP.cpp +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CustomUserControlViewManagerCPP.cpp @@ -8,7 +8,7 @@ #include "DebugHelpers.h" using namespace winrt; -using namespace Microsoft::ReactNative::Bridge; +using namespace Microsoft::ReactNative; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CustomUserControlViewManagerCPP.h b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CustomUserControlViewManagerCPP.h index af7b7795bfb..4eeeae3c10b 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CustomUserControlViewManagerCPP.h +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/CustomUserControlViewManagerCPP.h @@ -3,30 +3,30 @@ #pragma once -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" namespace winrt::SampleLibraryCpp::implementation { struct CustomUserControlViewManagerCpp : winrt::implements< CustomUserControlViewManagerCpp, - winrt::Microsoft::ReactNative::Bridge::IViewManager, - winrt::Microsoft::ReactNative::Bridge::IViewManagerWithNativeProperties, - winrt::Microsoft::ReactNative::Bridge::IViewManagerWithCommands, - winrt::Microsoft::ReactNative::Bridge::IViewManagerWithExportedEventTypeConstants> { + winrt::Microsoft::ReactNative::IViewManager, + winrt::Microsoft::ReactNative::IViewManagerWithNativeProperties, + winrt::Microsoft::ReactNative::IViewManagerWithCommands, + winrt::Microsoft::ReactNative::IViewManagerWithExportedEventTypeConstants> { public: - CustomUserControlViewManagerCpp(winrt::Microsoft::ReactNative::Bridge::IReactContext const &reactContext); + CustomUserControlViewManagerCpp(winrt::Microsoft::ReactNative::IReactContext const &reactContext); // IViewManager winrt::hstring Name() noexcept; - winrt::Microsoft::ReactNative::Bridge::IReactContext ReactContext() noexcept; + winrt::Microsoft::ReactNative::IReactContext ReactContext() noexcept; winrt::Windows::UI::Xaml::FrameworkElement CreateView() noexcept; // IViewManagerWithNativeProperties winrt::Windows::Foundation::Collections:: - IMapView + IMapView NativeProps() noexcept; void UpdateProperties( @@ -51,7 +51,7 @@ struct CustomUserControlViewManagerCpp ExportedCustomDirectEventTypeConstants() noexcept; private: - winrt::Microsoft::ReactNative::Bridge::IReactContext m_reactContext{nullptr}; + winrt::Microsoft::ReactNative::IReactContext m_reactContext{nullptr}; }; } // namespace winrt::SampleLibraryCpp::implementation diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/ReactPackageProvider.cpp b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/ReactPackageProvider.cpp index 30e87a27d64..f09bb8c1b6f 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/ReactPackageProvider.cpp +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/ReactPackageProvider.cpp @@ -11,7 +11,7 @@ #include "CustomUserControlViewManagerCpp.h" #include "SampleModuleCpp.h" -using namespace winrt::Microsoft::ReactNative::Bridge; +using namespace winrt::Microsoft::ReactNative; namespace winrt::SampleLibraryCpp::implementation { diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/ReactPackageProvider.h b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/ReactPackageProvider.h index 5d216819d6d..da799602fa2 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/ReactPackageProvider.h +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/ReactPackageProvider.h @@ -4,7 +4,7 @@ #pragma once #include "ReactPackageProvider.g.h" -using namespace winrt::Microsoft::ReactNative::Bridge; +using namespace winrt::Microsoft::ReactNative; namespace winrt::SampleLibraryCpp::implementation { diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/ReactPackageProvider.idl b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/ReactPackageProvider.idl index fcf80d86636..213b230d223 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/ReactPackageProvider.idl +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/ReactPackageProvider.idl @@ -6,7 +6,7 @@ namespace SampleLibraryCpp [webhosthidden] [default_interface] runtimeclass ReactPackageProvider - : Microsoft.ReactNative.Bridge.IReactPackageProvider { + : Microsoft.ReactNative.IReactPackageProvider { ReactPackageProvider(); }; } // namespace CppModule diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/SampleModuleCPP.h b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/SampleModuleCPP.h index e3ae22cd88b..b21180479e3 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/SampleModuleCPP.h +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/SampleModuleCPP.h @@ -77,7 +77,7 @@ struct SampleModuleCpp { } REACT_METHOD(ExplicitPromiseMethod); - void ExplicitPromiseMethod(winrt::Microsoft::ReactNative::Bridge::ReactPromise &&result) noexcept { + void ExplicitPromiseMethod(winrt::Microsoft::ReactNative::ReactPromise &&result) noexcept { DebugWriteLine(Name, "ExplicitPromiseMethod"); try { result.Resolve(M_PI); @@ -89,7 +89,7 @@ struct SampleModuleCpp { REACT_METHOD(ExplicitPromiseMethodWithArgs); void ExplicitPromiseMethodWithArgs( double arg, - winrt::Microsoft::ReactNative::Bridge::ReactPromise &&result) noexcept { + winrt::Microsoft::ReactNative::ReactPromise &&result) noexcept { DebugWriteLine(Name, "ExplicitPromiseMethodWithArgs", arg); try { result.Resolve(M_PI); diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/pch.h b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/pch.h index 255bdb5e40f..c546035cd6d 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/pch.h +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/pch.h @@ -15,5 +15,4 @@ #include #include -#include #include diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/CircleViewManagerCS.cs b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/CircleViewManagerCS.cs index c1ee5fa7779..2bb6345dfec 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/CircleViewManagerCS.cs +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/CircleViewManagerCS.cs @@ -7,7 +7,7 @@ using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Data; -using Microsoft.ReactNative.Bridge; +using Microsoft.ReactNative; namespace SampleLibraryCS { diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/CustomUserControlViewManagerCS.cs b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/CustomUserControlViewManagerCS.cs index df054119734..5cdd920e8bb 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/CustomUserControlViewManagerCS.cs +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/CustomUserControlViewManagerCS.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; +using Microsoft.ReactNative; +using Microsoft.ReactNative.Managed; using System.Diagnostics; - using Windows.UI.Xaml; -using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Controls; - -using Microsoft.ReactNative.Managed; -using Microsoft.ReactNative.Bridge; +using Windows.UI.Xaml.Media; namespace SampleLibraryCS { diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/ReactPackageProvider.cs b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/ReactPackageProvider.cs index d36bbd1c9b9..6fd469a3ebb 100644 --- a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/ReactPackageProvider.cs +++ b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/ReactPackageProvider.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; +using Microsoft.ReactNative; using Microsoft.ReactNative.Managed; namespace SampleLibraryCS diff --git a/vnext/Microsoft.ReactNative.Cxx.UnitTests/JSValueReaderTest.cpp b/vnext/Microsoft.ReactNative.Cxx.UnitTests/JSValueReaderTest.cpp index be9941c7d02..0e0c753091d 100644 --- a/vnext/Microsoft.ReactNative.Cxx.UnitTests/JSValueReaderTest.cpp +++ b/vnext/Microsoft.ReactNative.Cxx.UnitTests/JSValueReaderTest.cpp @@ -8,7 +8,7 @@ #include "JsonJSValueReader.h" #include "catch.hpp" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { enum struct RobotModel { T2, @@ -463,4 +463,4 @@ TEST_CASE("TestWriteValueDefaultExtensions", "JSValueReaderTest") { REQUIRE(jsValue["NullValue"] == JSValue::Null); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx.UnitTests/JSValueTest.cpp b/vnext/Microsoft.ReactNative.Cxx.UnitTests/JSValueTest.cpp index 4096b502235..629ef8f1116 100644 --- a/vnext/Microsoft.ReactNative.Cxx.UnitTests/JSValueTest.cpp +++ b/vnext/Microsoft.ReactNative.Cxx.UnitTests/JSValueTest.cpp @@ -6,7 +6,7 @@ #include "JsonJSValueReader.h" #include "catch.hpp" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { TEST_CASE("TestReadObject", "JSValueTest") { const wchar_t *json = @@ -92,4 +92,4 @@ TEST_CASE("TestReadNestedArray", "JSValueTest") { REQUIRE(nestedArr[6].Double() == 4.5); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonJSValueReader.cpp b/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonJSValueReader.cpp index 9af889d2a38..0e199bbcf92 100644 --- a/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonJSValueReader.cpp +++ b/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonJSValueReader.cpp @@ -4,7 +4,7 @@ #include "pch.h" #include "JsonJSValueReader.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { //=========================================================================== // JsonJSValueReader implementation @@ -157,4 +157,4 @@ bool JsonJSValueReader::IsContainerOrValue(JsonParseState parseState) noexcept { parseState == JsonParseState::Value; } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonJSValueReader.h b/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonJSValueReader.h index 08361f20012..83aef8cedcd 100644 --- a/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonJSValueReader.h +++ b/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonJSValueReader.h @@ -4,9 +4,9 @@ #pragma once #include "JsonReader.h" -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { struct JsonJSValueReader : implements { JsonJSValueReader(std::wstring &&jsonText) noexcept; @@ -39,4 +39,4 @@ struct JsonJSValueReader : implements { }; }; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonReader.cpp b/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonReader.cpp index f67579fa23c..c239f2198e3 100644 --- a/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonReader.cpp +++ b/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonReader.cpp @@ -9,7 +9,7 @@ #include "JsonReader.h" #include "Crash.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { static bool IsSimpleWhitespace(wchar_t c) noexcept { return (c == ' ' || c == '\t' || c == '\r' || c == '\n'); @@ -376,4 +376,4 @@ bool JsonReader::IsNull() noexcept { return false; } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonReader.h b/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonReader.h index 34b4f332f07..ae3b452410f 100644 --- a/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonReader.h +++ b/vnext/Microsoft.ReactNative.Cxx.UnitTests/JsonReader.h @@ -7,7 +7,7 @@ #include #include -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { struct JsonSource { static_assert(sizeof(wchar_t) == 2, "This code expects 2-byte wchars"); @@ -141,4 +141,4 @@ struct JsonReader { bool m_isStringContent = false; }; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx.UnitTests/NativeModuleTest.cpp b/vnext/Microsoft.ReactNative.Cxx.UnitTests/NativeModuleTest.cpp index 554e1510084..c73fd48c312 100644 --- a/vnext/Microsoft.ReactNative.Cxx.UnitTests/NativeModuleTest.cpp +++ b/vnext/Microsoft.ReactNative.Cxx.UnitTests/NativeModuleTest.cpp @@ -7,7 +7,7 @@ #include "ReactModuleBuilderMock.h" #include "catch.hpp" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { REACT_STRUCT(Point) struct Point { @@ -772,4 +772,4 @@ TEST_CASE_METHOD(NativeModuleTestFixture, "TestEvent_EventField2", "NativeModule REQUIRE(eventRaised == true); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx.UnitTests/ReactModuleBuilderMock.cpp b/vnext/Microsoft.ReactNative.Cxx.UnitTests/ReactModuleBuilderMock.cpp index d798a9ee6e3..8f5e2a21333 100644 --- a/vnext/Microsoft.ReactNative.Cxx.UnitTests/ReactModuleBuilderMock.cpp +++ b/vnext/Microsoft.ReactNative.Cxx.UnitTests/ReactModuleBuilderMock.cpp @@ -5,7 +5,7 @@ #include "ReactModuleBuilderMock.h" #include "JSValue.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { //=========================================================================== // ReactModuleBuilderMock implementation @@ -97,4 +97,4 @@ SyncMethodDelegate ReactModuleBuilderMock::GetSyncMethod(std::wstring const &met return MakeJSValueTreeReader(std::move(jsValue)); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx.UnitTests/ReactModuleBuilderMock.h b/vnext/Microsoft.ReactNative.Cxx.UnitTests/ReactModuleBuilderMock.h index 35fa6bb2233..1be09fb0674 100644 --- a/vnext/Microsoft.ReactNative.Cxx.UnitTests/ReactModuleBuilderMock.h +++ b/vnext/Microsoft.ReactNative.Cxx.UnitTests/ReactModuleBuilderMock.h @@ -6,7 +6,7 @@ #include #include "JSValue.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { struct ReactModuleBuilderMock { template @@ -220,4 +220,4 @@ inline void ReactModuleBuilderImpl::AddEventHandlerSetter( m_mock.AddEventHandlerSetter(name, eventHandlerSetter); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx.UnitTests/pch.h b/vnext/Microsoft.ReactNative.Cxx.UnitTests/pch.h index 72e7480e50d..12be6f0b99f 100644 --- a/vnext/Microsoft.ReactNative.Cxx.UnitTests/pch.h +++ b/vnext/Microsoft.ReactNative.Cxx.UnitTests/pch.h @@ -4,4 +4,4 @@ #pragma once #include #include -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" diff --git a/vnext/Microsoft.ReactNative.Cxx/JSValue.cpp b/vnext/Microsoft.ReactNative.Cxx/JSValue.cpp index 00cb2097a94..e4f0ae738a6 100644 --- a/vnext/Microsoft.ReactNative.Cxx/JSValue.cpp +++ b/vnext/Microsoft.ReactNative.Cxx/JSValue.cpp @@ -4,7 +4,7 @@ #include "pch.h" #include "JSValue.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { //=========================================================================== // JSValue implementation @@ -324,4 +324,4 @@ void swap(JSValue &left, JSValue &right) noexcept { left = std::move(temp); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx/JSValue.h b/vnext/Microsoft.ReactNative.Cxx/JSValue.h index ca17710404d..b76bcfefa4a 100644 --- a/vnext/Microsoft.ReactNative.Cxx/JSValue.h +++ b/vnext/Microsoft.ReactNative.Cxx/JSValue.h @@ -6,9 +6,9 @@ #define MICROSOFT_REACTNATIVE_JSVALUE #include "Crash.h" -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { // Forward declarations struct JSValue; @@ -250,6 +250,6 @@ inline bool operator!=(const JSValue &left, const JSValue &right) noexcept { return !left.Equals(right); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative #endif // MICROSOFT_REACTNATIVE_JSVALUE diff --git a/vnext/Microsoft.ReactNative.Cxx/JSValueReader.h b/vnext/Microsoft.ReactNative.Cxx/JSValueReader.h index 259a7b46235..ec16dae864c 100644 --- a/vnext/Microsoft.ReactNative.Cxx/JSValueReader.h +++ b/vnext/Microsoft.ReactNative.Cxx/JSValueReader.h @@ -8,9 +8,9 @@ #include "JSValue.h" #include "JSValueTreeReader.h" #include "StructInfo.h" -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { // A value can be read from IJSValueReader in one of three ways: // 1. Using a ReadValue standalone function with IJSValueReader& as a first argument. @@ -434,6 +434,6 @@ inline void ReadArgs(IJSValueReader const &reader, /*out*/ TArgs &... args) noex success = success && SkipArrayToEnd(reader); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative #endif // MICROSOFT_REACTNATIVE_JSVALUEREADER diff --git a/vnext/Microsoft.ReactNative.Cxx/JSValueTreeReader.cpp b/vnext/Microsoft.ReactNative.Cxx/JSValueTreeReader.cpp index 1d04aa5142c..43138a80889 100644 --- a/vnext/Microsoft.ReactNative.Cxx/JSValueTreeReader.cpp +++ b/vnext/Microsoft.ReactNative.Cxx/JSValueTreeReader.cpp @@ -4,7 +4,7 @@ #include "pch.h" #include "JSValueTreeReader.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { //=========================================================================== // JSValueTreeReader implementation @@ -125,4 +125,4 @@ IJSValueReader MakeJSValueTreeReader(JSValue &&root) noexcept { return make(std::move(root)); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx/JSValueTreeReader.h b/vnext/Microsoft.ReactNative.Cxx/JSValueTreeReader.h index 11179793806..18e11a7b7a2 100644 --- a/vnext/Microsoft.ReactNative.Cxx/JSValueTreeReader.h +++ b/vnext/Microsoft.ReactNative.Cxx/JSValueTreeReader.h @@ -7,7 +7,7 @@ #include "JSValue.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { struct JSValueTreeReader : implements { JSValueTreeReader(const JSValue &value) noexcept; @@ -43,6 +43,6 @@ struct JSValueTreeReader : implements { std::vector m_stack; }; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative #endif // MICROSOFT_REACTNATIVE_JSVALUETREEREADER diff --git a/vnext/Microsoft.ReactNative.Cxx/JSValueTreeWriter.cpp b/vnext/Microsoft.ReactNative.Cxx/JSValueTreeWriter.cpp index 7717c8e7942..9cf32d79492 100644 --- a/vnext/Microsoft.ReactNative.Cxx/JSValueTreeWriter.cpp +++ b/vnext/Microsoft.ReactNative.Cxx/JSValueTreeWriter.cpp @@ -5,7 +5,7 @@ #include "JSValueTreeWriter.h" #include "Crash.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { //=========================================================================== // JSValueTreeWriter implementation @@ -84,4 +84,4 @@ IJSValueWriter MakeJSValueTreeWriter(JSValue &resultValue) noexcept { return make(resultValue); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx/JSValueTreeWriter.h b/vnext/Microsoft.ReactNative.Cxx/JSValueTreeWriter.h index 7c5f2c84d15..31259e505a9 100644 --- a/vnext/Microsoft.ReactNative.Cxx/JSValueTreeWriter.h +++ b/vnext/Microsoft.ReactNative.Cxx/JSValueTreeWriter.h @@ -8,7 +8,7 @@ #include #include "JSValue.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { // Writes to a tree of JSValue objects. struct JSValueTreeWriter : implements { @@ -46,6 +46,6 @@ struct JSValueTreeWriter : implements { JSValue &m_resultValue; }; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative #endif // MICROSOFT_REACTNATIVE_JSVALUETREEWRITER diff --git a/vnext/Microsoft.ReactNative.Cxx/JSValueWriter.h b/vnext/Microsoft.ReactNative.Cxx/JSValueWriter.h index dccf5eebe62..208f374de61 100644 --- a/vnext/Microsoft.ReactNative.Cxx/JSValueWriter.h +++ b/vnext/Microsoft.ReactNative.Cxx/JSValueWriter.h @@ -6,9 +6,9 @@ #define MICROSOFT_REACTNATIVE_JSVALUEWRITER #include "StructInfo.h" -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { //============================================================================== // IJSValueWriter extensions @@ -231,6 +231,6 @@ inline void WriteArgs(IJSValueWriter const &writer, TArgs const &... args) noexc writer.WriteArrayEnd(); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative #endif // MICROSOFT_REACTNATIVE_JSVALUEWRITER diff --git a/vnext/Microsoft.ReactNative.Cxx/ModuleMemberRegistration.h b/vnext/Microsoft.ReactNative.Cxx/ModuleMemberRegistration.h index 159f3168351..9ee5f21543c 100644 --- a/vnext/Microsoft.ReactNative.Cxx/ModuleMemberRegistration.h +++ b/vnext/Microsoft.ReactNative.Cxx/ModuleMemberRegistration.h @@ -12,11 +12,11 @@ // Registration of a method relies on a TLS context that is setup when object is // created. The advantage is that we do zero work during static initialization. // The disadvantage is that we require to have one bool field per registration. -#define INTERNAL_REACT_METHOD_3_ARGS(methodType, method, methodName) \ - template \ - static void RegisterMember( \ - TRegistry ®istry, winrt::Microsoft::ReactNative::Bridge::ReactMemberId<__COUNTER__>) noexcept { \ - registry.Register##methodType##Method(&TClass::method, methodName); \ +#define INTERNAL_REACT_METHOD_3_ARGS(methodType, method, methodName) \ + template \ + static void RegisterMember( \ + TRegistry ®istry, winrt::Microsoft::ReactNative::ReactMemberId<__COUNTER__>) noexcept { \ + registry.Register##methodType##Method(&TClass::method, methodName); \ } #define INTERNAL_REACT_METHOD_2_ARGS(methodType, method) INTERNAL_REACT_METHOD_3_ARGS(methodType, method, L## #method) @@ -28,11 +28,11 @@ #define INTERNAL_REACT_METHOD(...) \ INTERNAL_REACT_MEMBER_RECOMPOSER((__VA_ARGS__, INTERNAL_REACT_METHOD_3_ARGS, INTERNAL_REACT_METHOD_2_ARGS, )) -#define INTERNAL_REACT_CONSTANT_2_ARGS(field, constantName) \ - template \ - static void RegisterMember( \ - TRegistry ®istry, winrt::Microsoft::ReactNative::Bridge::ReactMemberId<__COUNTER__>) noexcept { \ - registry.RegisterConstant(&TClass::field, constantName); \ +#define INTERNAL_REACT_CONSTANT_2_ARGS(field, constantName) \ + template \ + static void RegisterMember( \ + TRegistry ®istry, winrt::Microsoft::ReactNative::ReactMemberId<__COUNTER__>) noexcept { \ + registry.RegisterConstant(&TClass::field, constantName); \ } #define INTERNAL_REACT_CONSTANT_1_ARGS(field) INTERNAL_REACT_CONSTANT_2_ARGS(field, L## #field) @@ -40,11 +40,11 @@ #define INTERNAL_REACT_CONSTANT(...) \ INTERNAL_REACT_MEMBER_RECOMPOSER((__VA_ARGS__, INTERNAL_REACT_CONSTANT_2_ARGS, INTERNAL_REACT_CONSTANT_1_ARGS, )) -#define INTERNAL_REACT_EVENT_2_ARGS(field, eventName) \ - template \ - static void RegisterMember( \ - TRegistry ®istry, winrt::Microsoft::ReactNative::Bridge::ReactMemberId<__COUNTER__>) noexcept { \ - registry.RegisterEvent(&TClass::field, eventName); \ +#define INTERNAL_REACT_EVENT_2_ARGS(field, eventName) \ + template \ + static void RegisterMember( \ + TRegistry ®istry, winrt::Microsoft::ReactNative::ReactMemberId<__COUNTER__>) noexcept { \ + registry.RegisterEvent(&TClass::field, eventName); \ } #define INTERNAL_REACT_EVENT_1_ARGS(field) INTERNAL_REACT_EVENT_2_ARGS(field, L## #field) diff --git a/vnext/Microsoft.ReactNative.Cxx/ModuleRegistration.cpp b/vnext/Microsoft.ReactNative.Cxx/ModuleRegistration.cpp index f9c2c7ae96d..0478f1ceca0 100644 --- a/vnext/Microsoft.ReactNative.Cxx/ModuleRegistration.cpp +++ b/vnext/Microsoft.ReactNative.Cxx/ModuleRegistration.cpp @@ -4,7 +4,7 @@ #include "pch.h" #include "ModuleRegistration.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { const ModuleRegistration *ModuleRegistration::s_head{nullptr}; @@ -12,10 +12,10 @@ ModuleRegistration::ModuleRegistration(const wchar_t *moduleName) noexcept : m_m s_head = this; } -void AddAttributedModules(winrt::Microsoft::ReactNative::Bridge::IReactPackageBuilder const &packageBuilder) noexcept { +void AddAttributedModules(IReactPackageBuilder const &packageBuilder) noexcept { for (const ModuleRegistration *reg = ModuleRegistration::Head(); reg != nullptr; reg = reg->Next()) { packageBuilder.AddModule(winrt::to_hstring(reg->ModuleName()), reg->MakeModuleProvider()); } } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx/ModuleRegistration.h b/vnext/Microsoft.ReactNative.Cxx/ModuleRegistration.h index 3ca2213bdf4..acfcc52a3d2 100644 --- a/vnext/Microsoft.ReactNative.Cxx/ModuleRegistration.h +++ b/vnext/Microsoft.ReactNative.Cxx/ModuleRegistration.h @@ -2,31 +2,30 @@ // Licensed under the MIT License. #pragma once -#include "winrt/Microsoft.ReactNative.Bridge.h" - -#define INTERNAL_REACT_MODULE_3_ARGS(moduleClass, moduleName, eventEmitterName) \ - struct moduleClass; \ - \ - template \ - struct moduleClass##_ModuleRegistration final : winrt::Microsoft::ReactNative::Bridge::ModuleRegistration { \ - moduleClass##_ModuleRegistration() noexcept \ - : winrt::Microsoft::ReactNative::Bridge::ModuleRegistration(moduleName) {} \ - \ - winrt::Microsoft::ReactNative::Bridge::ReactModuleProvider MakeModuleProvider() const noexcept override { \ - return winrt::Microsoft::ReactNative::Bridge::MakeModuleProvider(); \ - } \ - \ - static const moduleClass##_ModuleRegistration Registration; \ - }; \ - \ - template \ - const moduleClass##_ModuleRegistration moduleClass##_ModuleRegistration::Registration; \ - template struct moduleClass##_ModuleRegistration; \ - \ - template \ - void RegisterModule(TRegistry ®istry, moduleClass *) noexcept { \ - registry.RegisterModule( \ - moduleName, eventEmitterName, winrt::Microsoft::ReactNative::Bridge::ReactMemberId<__COUNTER__>{}); \ +#include "winrt/Microsoft.ReactNative.h" + +#define INTERNAL_REACT_MODULE_3_ARGS(moduleClass, moduleName, eventEmitterName) \ + struct moduleClass; \ + \ + template \ + struct moduleClass##_ModuleRegistration final : winrt::Microsoft::ReactNative::ModuleRegistration { \ + moduleClass##_ModuleRegistration() noexcept : winrt::Microsoft::ReactNative::ModuleRegistration(moduleName) {} \ + \ + winrt::Microsoft::ReactNative::ReactModuleProvider MakeModuleProvider() const noexcept override { \ + return winrt::Microsoft::ReactNative::MakeModuleProvider(); \ + } \ + \ + static const moduleClass##_ModuleRegistration Registration; \ + }; \ + \ + template \ + const moduleClass##_ModuleRegistration moduleClass##_ModuleRegistration::Registration; \ + template struct moduleClass##_ModuleRegistration; \ + \ + template \ + void RegisterModule(TRegistry ®istry, moduleClass *) noexcept { \ + registry.RegisterModule( \ + moduleName, eventEmitterName, winrt::Microsoft::ReactNative::ReactMemberId<__COUNTER__>{}); \ } #define INTERNAL_REACT_MODULE_2_ARGS(moduleClass, moduleName) INTERNAL_REACT_MODULE_3_ARGS(moduleClass, moduleName, L"") @@ -41,12 +40,12 @@ INTERNAL_REACT_MODULE_RECOMPOSER( \ (__VA_ARGS__, INTERNAL_REACT_MODULE_3_ARGS, INTERNAL_REACT_MODULE_2_ARGS, INTERNAL_REACT_MODULE_1_ARGS, )) -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { struct ModuleRegistration { ModuleRegistration(const wchar_t *moduleName) noexcept; - virtual winrt::Microsoft::ReactNative::Bridge::ReactModuleProvider MakeModuleProvider() const noexcept = 0; + virtual ReactModuleProvider MakeModuleProvider() const noexcept = 0; static const ModuleRegistration *Head() noexcept { return s_head; @@ -67,6 +66,6 @@ struct ModuleRegistration { static const ModuleRegistration *s_head; }; -void AddAttributedModules(winrt::Microsoft::ReactNative::Bridge::IReactPackageBuilder const &packageBuilder) noexcept; +void AddAttributedModules(IReactPackageBuilder const &packageBuilder) noexcept; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx/ModuleRegistry.h b/vnext/Microsoft.ReactNative.Cxx/ModuleRegistry.h index 9821cbd108c..fe4b02ea146 100644 --- a/vnext/Microsoft.ReactNative.Cxx/ModuleRegistry.h +++ b/vnext/Microsoft.ReactNative.Cxx/ModuleRegistry.h @@ -4,7 +4,7 @@ #include "ReactMemberInfo.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { struct ModuleRegistry { template @@ -14,4 +14,4 @@ struct ModuleRegistry { void RegisterModule(wchar_t const *moduleName, wchar_t const *eventEmitterName, ReactMemberId) noexcept; }; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx/NativeModules.h b/vnext/Microsoft.ReactNative.Cxx/NativeModules.h index 8ce5939498a..3d07dc9b841 100644 --- a/vnext/Microsoft.ReactNative.Cxx/NativeModules.h +++ b/vnext/Microsoft.ReactNative.Cxx/NativeModules.h @@ -2,7 +2,7 @@ // Licensed under the MIT License. #pragma once -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" #include #include "JSValueReader.h" @@ -53,7 +53,7 @@ // Use with a field for events #define REACT_EVENT(/* field, [opt] eventName */...) INTERNAL_REACT_EVENT(__VA_ARGS__)(__VA_ARGS__) -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { namespace Internal { @@ -653,10 +653,7 @@ struct ReactModuleBuilder { : m_module{module}, m_moduleBuilder{moduleBuilder} {} template - void RegisterModule( - const wchar_t * /*moduleName*/, - const wchar_t *eventEmitterName, - winrt::Microsoft::ReactNative::Bridge::ReactMemberId) noexcept { + void RegisterModule(const wchar_t * /*moduleName*/, const wchar_t *eventEmitterName, ReactMemberId) noexcept { m_moduleBuilder.SetEventEmitterName(eventEmitterName); RegisterMembers(); } @@ -741,4 +738,4 @@ inline ReactModuleProvider MakeModuleProvider() noexcept { }; } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx/ReactError.h b/vnext/Microsoft.ReactNative.Cxx/ReactError.h index 2001c4ddfb9..50007809697 100644 --- a/vnext/Microsoft.ReactNative.Cxx/ReactError.h +++ b/vnext/Microsoft.ReactNative.Cxx/ReactError.h @@ -4,7 +4,7 @@ #pragma once #include "JSValue.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { struct ReactError { std::string Code; @@ -12,4 +12,4 @@ struct ReactError { JSValueObject UserInfo; }; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx/ReactMemberInfo.h b/vnext/Microsoft.ReactNative.Cxx/ReactMemberInfo.h index 0904a817214..fef9e0ff9a0 100644 --- a/vnext/Microsoft.ReactNative.Cxx/ReactMemberInfo.h +++ b/vnext/Microsoft.ReactNative.Cxx/ReactMemberInfo.h @@ -5,13 +5,13 @@ #ifndef MICROSOFT_REACTNATIVE_REACTMEMBERINFO #define MICROSOFT_REACTNATIVE_REACTMEMBERINFO -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { template using ReactMemberId = std::integral_constant; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative #endif // MICROSOFT_REACTNATIVE_REACTMEMBERINFO diff --git a/vnext/Microsoft.ReactNative.Cxx/ReactPromise.cpp b/vnext/Microsoft.ReactNative.Cxx/ReactPromise.cpp index 3c040827c74..e7e717bb873 100644 --- a/vnext/Microsoft.ReactNative.Cxx/ReactPromise.cpp +++ b/vnext/Microsoft.ReactNative.Cxx/ReactPromise.cpp @@ -5,7 +5,7 @@ #include "ReactPromise.h" #include "JSValueWriter.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { static const char *ErrorDefaultCode = "EUNSPECIFIED"; static const char *ErrorDefaultMessage = "Error not specified."; @@ -91,4 +91,4 @@ void ReactPromiseBase::Clear() noexcept { m_writer = nullptr; } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx/ReactPromise.h b/vnext/Microsoft.ReactNative.Cxx/ReactPromise.h index cfad8200963..65d6989598f 100644 --- a/vnext/Microsoft.ReactNative.Cxx/ReactPromise.h +++ b/vnext/Microsoft.ReactNative.Cxx/ReactPromise.h @@ -3,9 +3,9 @@ #pragma once #include "ReactError.h" -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { // ReactPromise represents a JavaScript Promise // which can be passed to the native module as a method parameter. @@ -53,4 +53,4 @@ void ReactPromise::Resolve(T const &value) noexcept { } } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative.Cxx/StructInfo.h b/vnext/Microsoft.ReactNative.Cxx/StructInfo.h index b87dd6a6fbd..f38bd183c68 100644 --- a/vnext/Microsoft.ReactNative.Cxx/StructInfo.h +++ b/vnext/Microsoft.ReactNative.Cxx/StructInfo.h @@ -5,25 +5,25 @@ #ifndef MICROSOFT_REACTNATIVE_STRUCTINFO #define MICROSOFT_REACTNATIVE_STRUCTINFO -#include "winrt/Microsoft.ReactNative.Bridge.h" - -#define REACT_STRUCT(type) \ - struct type; \ - winrt::Microsoft::ReactNative::Bridge::FieldMap GetStructInfo(type *) noexcept { \ - winrt::Microsoft::ReactNative::Bridge::FieldMap fieldMap{}; \ - winrt::Microsoft::ReactNative::Bridge::CollectStructFields(fieldMap); \ - return fieldMap; \ +#include "winrt/Microsoft.ReactNative.h" + +#define REACT_STRUCT(type) \ + struct type; \ + winrt::Microsoft::ReactNative::FieldMap GetStructInfo(type *) noexcept { \ + winrt::Microsoft::ReactNative::FieldMap fieldMap{}; \ + winrt::Microsoft::ReactNative::CollectStructFields(fieldMap); \ + return fieldMap; \ } -#define REACT_FIELD(field) \ - template \ - static void RegisterField( \ - winrt::Microsoft::ReactNative::Bridge::FieldMap &fieldMap, \ - winrt::Microsoft::ReactNative::Bridge::ReactFieldId<__COUNTER__>) noexcept { \ - fieldMap.emplace(L## #field, &TClass::field); \ +#define REACT_FIELD(field) \ + template \ + static void RegisterField( \ + winrt::Microsoft::ReactNative::FieldMap &fieldMap, \ + winrt::Microsoft::ReactNative::ReactFieldId<__COUNTER__>) noexcept { \ + fieldMap.emplace(L## #field, &TClass::field); \ } -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { struct FieldInfo; using FieldMap = std::map>; @@ -101,6 +101,6 @@ void CollectStructFields(FieldMap &fieldMap) noexcept { } } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative #endif // MICROSOFT_REACTNATIVE_STRUCTINFO diff --git a/vnext/Microsoft.ReactNative.Managed.UnitTests/JSValueReaderTest.cs b/vnext/Microsoft.ReactNative.Managed.UnitTests/JSValueReaderTest.cs index e0ac00251c9..5531704e962 100644 --- a/vnext/Microsoft.ReactNative.Managed.UnitTests/JSValueReaderTest.cs +++ b/vnext/Microsoft.ReactNative.Managed.UnitTests/JSValueReaderTest.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; using System; diff --git a/vnext/Microsoft.ReactNative.Managed.UnitTests/JSValueTest.cs b/vnext/Microsoft.ReactNative.Managed.UnitTests/JSValueTest.cs index dab01bcfc4f..3994b66d345 100644 --- a/vnext/Microsoft.ReactNative.Managed.UnitTests/JSValueTest.cs +++ b/vnext/Microsoft.ReactNative.Managed.UnitTests/JSValueTest.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; diff --git a/vnext/Microsoft.ReactNative.Managed.UnitTests/JTokenJSValueReader.cs b/vnext/Microsoft.ReactNative.Managed.UnitTests/JTokenJSValueReader.cs index 5f85a92aef5..75a3b01342b 100644 --- a/vnext/Microsoft.ReactNative.Managed.UnitTests/JTokenJSValueReader.cs +++ b/vnext/Microsoft.ReactNative.Managed.UnitTests/JTokenJSValueReader.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using Newtonsoft.Json.Linq; using System.Collections.Generic; diff --git a/vnext/Microsoft.ReactNative.Managed.UnitTests/JTokenJSValueWriter.cs b/vnext/Microsoft.ReactNative.Managed.UnitTests/JTokenJSValueWriter.cs index 90ee87f650c..84603a053a5 100644 --- a/vnext/Microsoft.ReactNative.Managed.UnitTests/JTokenJSValueWriter.cs +++ b/vnext/Microsoft.ReactNative.Managed.UnitTests/JTokenJSValueWriter.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; diff --git a/vnext/Microsoft.ReactNative.Managed.UnitTests/ReactModuleBuilderMock.cs b/vnext/Microsoft.ReactNative.Managed.UnitTests/ReactModuleBuilderMock.cs index 0c4e2a2f104..970eb058fcb 100644 --- a/vnext/Microsoft.ReactNative.Managed.UnitTests/ReactModuleBuilderMock.cs +++ b/vnext/Microsoft.ReactNative.Managed.UnitTests/ReactModuleBuilderMock.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Collections.Generic; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/AttributedViewManager.cs b/vnext/Microsoft.ReactNative.SharedManaged/AttributedViewManager.cs index 3802ca0e61c..1b2705c2554 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/AttributedViewManager.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/AttributedViewManager.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Collections.Generic; using System.Linq.Expressions; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/JSValue.cs b/vnext/Microsoft.ReactNative.SharedManaged/JSValue.cs index 1306d5e96ba..00643a4deca 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/JSValue.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/JSValue.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/JSValueReader.cs b/vnext/Microsoft.ReactNative.SharedManaged/JSValueReader.cs index 32f72e02e75..519b1c1f65f 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/JSValueReader.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/JSValueReader.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/JSValueReaderGenerator.cs b/vnext/Microsoft.ReactNative.SharedManaged/JSValueReaderGenerator.cs index d1597f97ff8..0751707a124 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/JSValueReaderGenerator.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/JSValueReaderGenerator.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Collections.Generic; using System.Linq; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/JSValueTreeReader.cs b/vnext/Microsoft.ReactNative.SharedManaged/JSValueTreeReader.cs index dc2d6ecba13..39ae71dd08b 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/JSValueTreeReader.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/JSValueTreeReader.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System.Collections.Generic; namespace Microsoft.ReactNative.Managed diff --git a/vnext/Microsoft.ReactNative.SharedManaged/JSValueTreeWriter.cs b/vnext/Microsoft.ReactNative.SharedManaged/JSValueTreeWriter.cs index 9acee67f15e..44ca8bd1b97 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/JSValueTreeWriter.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/JSValueTreeWriter.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/JSValueWriter.cs b/vnext/Microsoft.ReactNative.SharedManaged/JSValueWriter.cs index e1805ce9a4c..eab59acbeb0 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/JSValueWriter.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/JSValueWriter.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/JSValueWriterGenerator.cs b/vnext/Microsoft.ReactNative.SharedManaged/JSValueWriterGenerator.cs index 789eec48181..b910d38982c 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/JSValueWriterGenerator.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/JSValueWriterGenerator.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Collections.Generic; using System.Linq; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantInfo.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantInfo.cs index 72b4014ef94..d052abbc8cc 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantInfo.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Reflection; using System.Threading; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantProvider.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantProvider.cs index 238bcf19718..13d4ba8aa4a 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantProvider.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantProvider.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; - namespace Microsoft.ReactNative.Managed { class ReactConstantProvider diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantProviderInfo.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantProviderInfo.cs index 3c63b592c1b..799f85296c8 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantProviderInfo.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantProviderInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Reflection; using System.Threading; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactEvent.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactEvent.cs index 1e90340c824..d7ed1278914 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/ReactEvent.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactEvent.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; - namespace Microsoft.ReactNative.Managed { // The ReactEvent makes it explicit that a field is an event. diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactEventInfo.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactEventInfo.cs index 11017c33afb..d9f8b45869f 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/ReactEventInfo.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactEventInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Reflection; using System.Threading; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactMethodInfo.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactMethodInfo.cs index 72a802372d3..fdbbfb1403a 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/ReactMethodInfo.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactMethodInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Reflection; using System.Threading; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactModuleInfo.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactModuleInfo.cs index bf07ca75fa9..5222b4415eb 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/ReactModuleInfo.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactModuleInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Collections.Generic; using System.Linq; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactPackageBuilderExtensions.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactPackageBuilderExtensions.cs index 4688ad3feee..d20de81c82a 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/ReactPackageBuilderExtensions.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactPackageBuilderExtensions.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Linq; using System.Reflection; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactPackageProvider.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactPackageProvider.cs index 2f2486b917c..8c8fce10764 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/ReactPackageProvider.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactPackageProvider.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; - namespace Microsoft.ReactNative.Managed { class ReactPackageProvider : IReactPackageProvider diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactPromise.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactPromise.cs index bf808cbe4fb..eb3a3d4c59a 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/ReactPromise.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactPromise.cs @@ -12,7 +12,6 @@ // LICENSE file in the root directory of this source tree. // -using Microsoft.ReactNative.Bridge; using System.Collections.Generic; namespace Microsoft.ReactNative.Managed diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactSyncMethodInfo.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactSyncMethodInfo.cs index 86de8b61a66..31f192b4ebb 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/ReactSyncMethodInfo.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactSyncMethodInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; using System.Reflection; using System.Threading; diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ViewManagerAttributes.cs b/vnext/Microsoft.ReactNative.SharedManaged/ViewManagerAttributes.cs index 38cb37fbd95..489ee54cd3c 100644 --- a/vnext/Microsoft.ReactNative.SharedManaged/ViewManagerAttributes.cs +++ b/vnext/Microsoft.ReactNative.SharedManaged/ViewManagerAttributes.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.ReactNative.Bridge; using System; namespace Microsoft.ReactNative.Managed diff --git a/vnext/Microsoft.ReactNative/ABICxxModule.cpp b/vnext/Microsoft.ReactNative/ABICxxModule.cpp index 6148dceef95..ec5d48c3686 100644 --- a/vnext/Microsoft.ReactNative/ABICxxModule.cpp +++ b/vnext/Microsoft.ReactNative/ABICxxModule.cpp @@ -8,7 +8,7 @@ using namespace facebook::xplat::module; -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { constexpr auto DefaultEventEmitterName = "RCTDeviceEventEmitter"; @@ -70,4 +70,4 @@ void ABICxxModule::InitEvents(std::vector eventH } } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/ABICxxModule.h b/vnext/Microsoft.ReactNative/ABICxxModule.h index 48be6083348..d013bd86b42 100644 --- a/vnext/Microsoft.ReactNative/ABICxxModule.h +++ b/vnext/Microsoft.ReactNative/ABICxxModule.h @@ -11,9 +11,9 @@ #include "DynamicReader.h" #include "DynamicWriter.h" #include "cxxreact/CxxModule.h" -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { struct ABICxxModuleEventHandlerSetter { std::string Name; @@ -45,4 +45,4 @@ struct ABICxxModule : facebook::xplat::module::CxxModule { std::vector m_constants; }; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/ABIViewManager.cpp b/vnext/Microsoft.ReactNative/ABIViewManager.cpp index 2ff9c04dd40..ea183dd1373 100644 --- a/vnext/Microsoft.ReactNative/ABIViewManager.cpp +++ b/vnext/Microsoft.ReactNative/ABIViewManager.cpp @@ -7,11 +7,11 @@ #include #include "ReactSupport.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { ABIViewManager::ABIViewManager( const std::shared_ptr &reactInstance, - const winrt::Microsoft::ReactNative::Bridge::IViewManager &viewManager) + const ReactNative::IViewManager &viewManager) : Super(reactInstance), m_viewManager{viewManager}, m_viewManagerWithExportedViewConstants{viewManager.try_as()}, @@ -222,4 +222,4 @@ void ABIViewManager::ReplaceChild( } } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/ABIViewManager.h b/vnext/Microsoft.ReactNative/ABIViewManager.h index 89b81cea102..f87c539404a 100644 --- a/vnext/Microsoft.ReactNative/ABIViewManager.h +++ b/vnext/Microsoft.ReactNative/ABIViewManager.h @@ -17,16 +17,17 @@ #include #include -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" + +namespace winrt::Microsoft::ReactNative { -namespace winrt::Microsoft::ReactNative::Bridge { class ABIViewManager : public react::uwp::FrameworkElementViewManager { using Super = react::uwp::FrameworkElementViewManager; public: ABIViewManager( const std::shared_ptr &reactInstance, - const winrt::Microsoft::ReactNative::Bridge::IViewManager &viewManager); + const ReactNative::IViewManager &viewManager); const char *GetName() const override; @@ -62,14 +63,14 @@ class ABIViewManager : public react::uwp::FrameworkElementViewManager { winrt::Windows::UI::Xaml::DependencyObject CreateViewCore(int64_t) override; std::string m_name; - winrt::Microsoft::ReactNative::Bridge::IViewManager m_viewManager; - winrt::Microsoft::ReactNative::Bridge::IViewManagerWithExportedViewConstants m_viewManagerWithExportedViewConstants; - winrt::Microsoft::ReactNative::Bridge::IViewManagerWithNativeProperties m_viewManagerWithNativeProperties; - winrt::Microsoft::ReactNative::Bridge::IViewManagerWithCommands m_viewManagerWithCommands; - winrt::Microsoft::ReactNative::Bridge::IViewManagerWithExportedEventTypeConstants - m_viewManagerWithExportedEventTypeConstants; - winrt::Microsoft::ReactNative::Bridge::IViewManagerWithChildren m_viewManagerWithChildren; + ReactNative::IViewManager m_viewManager; + IViewManagerWithExportedViewConstants m_viewManagerWithExportedViewConstants; + IViewManagerWithNativeProperties m_viewManagerWithNativeProperties; + IViewManagerWithCommands m_viewManagerWithCommands; + IViewManagerWithExportedEventTypeConstants m_viewManagerWithExportedEventTypeConstants; + IViewManagerWithChildren m_viewManagerWithChildren; winrt::Windows::Foundation::Collections::IMapView m_nativeProps; }; -} // namespace winrt::Microsoft::ReactNative::Bridge + +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/DynamicReader.cpp b/vnext/Microsoft.ReactNative/DynamicReader.cpp index 209b1589014..30708713717 100644 --- a/vnext/Microsoft.ReactNative/DynamicReader.cpp +++ b/vnext/Microsoft.ReactNative/DynamicReader.cpp @@ -4,7 +4,7 @@ #include "pch.h" #include "DynamicReader.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { //=========================================================================== // DynamicReader implementation @@ -143,4 +143,4 @@ double DynamicReader::GetDouble() noexcept { return (m_current->type() == folly::dynamic::Type::DOUBLE) ? m_current->getDouble() : 0; } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/DynamicReader.h b/vnext/Microsoft.ReactNative/DynamicReader.h index c17ea2f58b2..9e4436acf89 100644 --- a/vnext/Microsoft.ReactNative/DynamicReader.h +++ b/vnext/Microsoft.ReactNative/DynamicReader.h @@ -4,9 +4,9 @@ #pragma once #include "folly/dynamic.h" -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { struct DynamicReader : implements { DynamicReader(const folly::dynamic &root) noexcept; @@ -41,4 +41,4 @@ struct DynamicReader : implements { std::vector m_stack; }; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/DynamicWriter.cpp b/vnext/Microsoft.ReactNative/DynamicWriter.cpp index 6083ec9a6d2..9b0b9cd9db2 100644 --- a/vnext/Microsoft.ReactNative/DynamicWriter.cpp +++ b/vnext/Microsoft.ReactNative/DynamicWriter.cpp @@ -5,7 +5,7 @@ #include "DynamicWriter.h" #include "Crash.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { //=========================================================================== // DynamicWriter implementation @@ -135,4 +135,4 @@ void DynamicWriter::WriteValue(folly::dynamic &&value) noexcept { } } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/DynamicWriter.h b/vnext/Microsoft.ReactNative/DynamicWriter.h index 685ed717c33..74ecc6ac859 100644 --- a/vnext/Microsoft.ReactNative/DynamicWriter.h +++ b/vnext/Microsoft.ReactNative/DynamicWriter.h @@ -3,11 +3,11 @@ // Licensed under the MIT License. #include "folly/dynamic.h" -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { -struct DynamicWriter : winrt::implements { +struct DynamicWriter : winrt::implements { folly::dynamic TakeValue() noexcept; public: // IJSValueWriter @@ -47,4 +47,4 @@ struct DynamicWriter : winrt::implements -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { struct ReactContext : winrt::implements { ReactContext(std::weak_ptr instance) noexcept : m_instance(instance) {} @@ -23,4 +23,4 @@ struct ReactContext : winrt::implements { std::weak_ptr m_instance; }; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/IReactContext.idl b/vnext/Microsoft.ReactNative/IReactContext.idl index 26fc2e5988c..a32cff65d6c 100644 --- a/vnext/Microsoft.ReactNative/IReactContext.idl +++ b/vnext/Microsoft.ReactNative/IReactContext.idl @@ -1,12 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -namespace Microsoft.ReactNative.Bridge -{ +namespace Microsoft.ReactNative { + [webhosthidden] - interface IReactContext - { + interface IReactContext { void DispatchEvent(Windows.UI.Xaml.FrameworkElement view, String eventName, IInspectable eventData); void CallJsFunction(String moduleName, String method, IInspectable params); - }; -} + } +} // namespace Microsoft.ReactNative diff --git a/vnext/Microsoft.ReactNative/IReactModuleBuilder.cpp b/vnext/Microsoft.ReactNative/IReactModuleBuilder.cpp index c2a68db9f08..50cfc0ef480 100644 --- a/vnext/Microsoft.ReactNative/IReactModuleBuilder.cpp +++ b/vnext/Microsoft.ReactNative/IReactModuleBuilder.cpp @@ -8,7 +8,7 @@ using namespace facebook::xplat::module; -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { //=========================================================================== // ReactModuleBuilder implementation @@ -102,4 +102,4 @@ std::unique_ptr ReactModuleBuilder::MakeCxxModule( nativeModule, name, m_eventEmitterName, m_methods, m_constants, m_eventHandlerSetters); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/IReactModuleBuilder.h b/vnext/Microsoft.ReactNative/IReactModuleBuilder.h index bf04af3ea30..ae7c0cd393e 100644 --- a/vnext/Microsoft.ReactNative/IReactModuleBuilder.h +++ b/vnext/Microsoft.ReactNative/IReactModuleBuilder.h @@ -4,9 +4,9 @@ #include "ABICxxModule.h" #include "cxxreact/CxxModule.h" -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { struct ReactModuleBuilder : winrt::implements { ReactModuleBuilder() noexcept; @@ -33,4 +33,4 @@ struct ReactModuleBuilder : winrt::implements m_eventHandlerSetters; }; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/IReactModuleBuilder.idl b/vnext/Microsoft.ReactNative/IReactModuleBuilder.idl index 3214a827a41..89f92507a1f 100644 --- a/vnext/Microsoft.ReactNative/IReactModuleBuilder.idl +++ b/vnext/Microsoft.ReactNative/IReactModuleBuilder.idl @@ -4,7 +4,8 @@ import "IJSValueReader.idl"; import "IJSValueWriter.idl"; -namespace Microsoft.ReactNative.Bridge { +namespace Microsoft.ReactNative { + enum MethodReturnType { Void, Callback, @@ -18,21 +19,19 @@ namespace Microsoft.ReactNative.Bridge { IJSValueWriter outputWriter, MethodResultCallback resolve, MethodResultCallback reject); - delegate void SyncMethodDelegate( - IJSValueReader inputReader, IJSValueWriter outputWriter); + delegate void SyncMethodDelegate(IJSValueReader inputReader, IJSValueWriter outputWriter); delegate void ConstantProvider(IJSValueWriter constantWriter); delegate void ReactArgWriter(IJSValueWriter writer); delegate void ReactEventHandler(ReactArgWriter argWriter); delegate void ReactEventHandlerSetter(ReactEventHandler eventHandler); + [webhosthidden] interface IReactModuleBuilder { void SetEventEmitterName(String name); - void AddMethod( - String name, MethodReturnType returnType, MethodDelegate method); + void AddMethod(String name, MethodReturnType returnType, MethodDelegate method); void AddSyncMethod(String name, SyncMethodDelegate method); void AddConstantProvider(ConstantProvider constantProvider); - void AddEventHandlerSetter( - String name, ReactEventHandlerSetter eventHandlerSetter); + void AddEventHandlerSetter(String name, ReactEventHandlerSetter eventHandlerSetter); }; -} // namespace Microsoft.ReactNative.Bridge +} // namespace Microsoft.ReactNative diff --git a/vnext/Microsoft.ReactNative/IReactPackageBuilder.idl b/vnext/Microsoft.ReactNative/IReactPackageBuilder.idl index 1540e20b779..438ba649bb7 100644 --- a/vnext/Microsoft.ReactNative/IReactPackageBuilder.idl +++ b/vnext/Microsoft.ReactNative/IReactPackageBuilder.idl @@ -5,16 +5,14 @@ import "IReactContext.idl"; import "IReactModuleBuilder.idl"; import "IViewManager.idl"; -namespace Microsoft.ReactNative.Bridge { +namespace Microsoft.ReactNative { delegate Object ReactModuleProvider(IReactModuleBuilder moduleBuilder); delegate IViewManager ReactViewManagerProvider(IReactContext reactContext); + [webhosthidden] interface IReactPackageBuilder { - // TODO: Add message thread argument void AddModule(String moduleName, ReactModuleProvider moduleProvider); - void AddViewManager( - String viewManagerName, ReactViewManagerProvider viewManagerProvider); - }; - -} // namespace Microsoft.ReactNative.Bridge + void AddViewManager(String viewManagerName, ReactViewManagerProvider viewManagerProvider); + } +} // namespace Microsoft.ReactNative diff --git a/vnext/Microsoft.ReactNative/IReactPackageProvider.idl b/vnext/Microsoft.ReactNative/IReactPackageProvider.idl index a99a11c81eb..d432209e9be 100644 --- a/vnext/Microsoft.ReactNative/IReactPackageProvider.idl +++ b/vnext/Microsoft.ReactNative/IReactPackageProvider.idl @@ -3,11 +3,12 @@ import "IReactPackageBuilder.idl"; -namespace Microsoft.ReactNative.Bridge { +namespace Microsoft.ReactNative { // This interface is to be implemented by package creators. + [webhosthidden] interface IReactPackageProvider { void CreatePackage(IReactPackageBuilder packageBuilder); }; -} // namespace Microsoft.ReactNative.Bridge +} // namespace Microsoft.ReactNative diff --git a/vnext/Microsoft.ReactNative/IViewManager.idl b/vnext/Microsoft.ReactNative/IViewManager.idl index e0be6b2f61a..cecec9e2fbc 100644 --- a/vnext/Microsoft.ReactNative/IViewManager.idl +++ b/vnext/Microsoft.ReactNative/IViewManager.idl @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -namespace Microsoft.ReactNative.Bridge +namespace Microsoft.ReactNative { [webhosthidden] - enum ViewManagerPropertyType - { + enum ViewManagerPropertyType { Boolean, Number, String, @@ -20,7 +19,7 @@ namespace Microsoft.ReactNative.Bridge String Name { get; }; Windows.UI.Xaml.FrameworkElement CreateView(); - }; + } [webhosthidden] interface IViewManagerWithExportedViewConstants @@ -34,7 +33,7 @@ namespace Microsoft.ReactNative.Bridge Windows.Foundation.Collections.IMapView NativeProps { get; }; void UpdateProperties(Windows.UI.Xaml.FrameworkElement view, Windows.Foundation.Collections.IMapView propertyMap); - }; + } [webhosthidden] interface IViewManagerWithCommands @@ -42,7 +41,7 @@ namespace Microsoft.ReactNative.Bridge Windows.Foundation.Collections.IMapView Commands { get; }; void DispatchCommand(Windows.UI.Xaml.FrameworkElement view, Int64 commandId, Windows.Foundation.Collections.IVectorView commandArgs); - }; + } [webhosthidden] interface IViewManagerWithExportedEventTypeConstants @@ -50,7 +49,7 @@ namespace Microsoft.ReactNative.Bridge Windows.Foundation.Collections.IMapView ExportedCustomBubblingEventTypeConstants { get; }; Windows.Foundation.Collections.IMapView ExportedCustomDirectEventTypeConstants { get; }; - }; + } [webhosthidden] interface IViewManagerWithChildren @@ -62,5 +61,5 @@ namespace Microsoft.ReactNative.Bridge void RemoveChildAt(Windows.UI.Xaml.FrameworkElement parent, Int64 index); void ReplaceChild(Windows.UI.Xaml.FrameworkElement parent, Windows.UI.Xaml.UIElement oldChild, Windows.UI.Xaml.UIElement newChild); - }; -} + } +} // namespace Microsoft.ReactNative diff --git a/vnext/Microsoft.ReactNative/NativeModulesProvider.cpp b/vnext/Microsoft.ReactNative/NativeModulesProvider.cpp index 15a27bd8084..6904807a9a8 100644 --- a/vnext/Microsoft.ReactNative/NativeModulesProvider.cpp +++ b/vnext/Microsoft.ReactNative/NativeModulesProvider.cpp @@ -12,7 +12,7 @@ using namespace winrt; using namespace Windows::Foundation; -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { /*------------------------------------------------------------------------------- NativeModulesProvider::GetModules -------------------------------------------------------------------------------*/ @@ -51,4 +51,4 @@ void NativeModulesProvider::AddModuleProvider( m_moduleProviders.emplace(to_string(moduleName), moduleProvider); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/NativeModulesProvider.h b/vnext/Microsoft.ReactNative/NativeModulesProvider.h index d7eb4f359e1..cdea37f205b 100644 --- a/vnext/Microsoft.ReactNative/NativeModulesProvider.h +++ b/vnext/Microsoft.ReactNative/NativeModulesProvider.h @@ -3,15 +3,10 @@ // Licensed under the MIT License. #include -#include #include #include "ReactSupport.h" -using namespace winrt; -using namespace Microsoft::ReactNative; -using namespace Windows::Foundation; - -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { class NativeModulesProvider final : public facebook::react::NativeModuleProvider { public: @@ -23,9 +18,9 @@ class NativeModulesProvider final : public facebook::react::NativeModuleProvider void AddModuleProvider(winrt::hstring const &moduleName, ReactModuleProvider const &moduleProvider) noexcept; private: - std::map m_moduleProviders; + std::map m_moduleProviders; std::shared_ptr m_modulesWorkerQueue{nullptr}; - Microsoft::ReactNative::Bridge::IReactPackageBuilder m_packageBuilder; + IReactPackageBuilder m_packageBuilder; }; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/ReactApplication.cpp b/vnext/Microsoft.ReactNative/ReactApplication.cpp index fe4ed7e0dac..54543c9226b 100644 --- a/vnext/Microsoft.ReactNative/ReactApplication.cpp +++ b/vnext/Microsoft.ReactNative/ReactApplication.cpp @@ -11,10 +11,10 @@ #include using namespace winrt; -using namespace Microsoft::ReactNative; using namespace Windows::ApplicationModel; using namespace Windows::ApplicationModel::Activation; using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; using namespace Windows::UI::Core; using namespace Windows::UI::Xaml; using namespace Windows::UI::Xaml::Controls; @@ -35,7 +35,7 @@ ReactApplication::ReactApplication() noexcept { #endif } -Microsoft::ReactNative::ReactInstanceSettings ReactApplication::InstanceSettings() noexcept { +ReactNative::ReactInstanceSettings ReactApplication::InstanceSettings() noexcept { if (!m_instanceSettings) { m_instanceSettings = make(); m_instanceSettings.UseWebDebugger(false); @@ -55,7 +55,7 @@ IVector ReactApplication::PackageProviders() noexcept { return m_packageProviders; } -Microsoft::ReactNative::ReactNativeHost ReactApplication::Host() noexcept { +ReactNative::ReactNativeHost ReactApplication::Host() noexcept { if (!m_host) { m_host = make(); m_host.InstanceSettings(InstanceSettings()); @@ -168,7 +168,7 @@ void ReactApplication::OnNavigationFailed(IInspectable const &, NavigationFailed } ReactApplicationDelegate __stdcall ReactApplication::CreateReactApplicationDelegate() { - return winrt::Microsoft::ReactNative::ReactApplicationDelegate(*this); + return ReactApplicationDelegate(*this); } } // namespace winrt::Microsoft::ReactNative::implementation diff --git a/vnext/Microsoft.ReactNative/ReactApplication.h b/vnext/Microsoft.ReactNative/ReactApplication.h index fded7c9337e..eaa804b26cf 100644 --- a/vnext/Microsoft.ReactNative/ReactApplication.h +++ b/vnext/Microsoft.ReactNative/ReactApplication.h @@ -1,27 +1,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + #pragma once #include "ReactApplication.g.h" #include "ReactNativeHost.h" -using namespace winrt; -using namespace Windows::ApplicationModel; -using namespace Windows::UI::Xaml::Navigation; -using namespace Microsoft::ReactNative; -using namespace Microsoft::ReactNative::Bridge; -using namespace Windows::Foundation::Collections; - namespace winrt::Microsoft::ReactNative::implementation { struct ReactApplication : ReactApplicationT { ReactApplication() noexcept; - Microsoft::ReactNative::ReactInstanceSettings InstanceSettings() noexcept; - void InstanceSettings(Microsoft::ReactNative::ReactInstanceSettings const &value) noexcept; + ReactNative::ReactInstanceSettings InstanceSettings() noexcept; + void InstanceSettings(ReactNative::ReactInstanceSettings const &value) noexcept; - IVector PackageProviders() noexcept; - void PackageProviders(IVector const &value) noexcept; + Windows::Foundation::Collections::IVector PackageProviders() noexcept; + void PackageProviders(Windows::Foundation::Collections::IVector const &value) noexcept; hstring MainComponentName() noexcept; void MainComponentName(hstring const &value) noexcept; @@ -35,27 +29,29 @@ struct ReactApplication : ReactApplicationT { hstring JavaScriptBundleFile() noexcept; void JavaScriptBundleFile(hstring const &value) noexcept; - Microsoft::ReactNative::ReactNativeHost Host() noexcept; + ReactNative::ReactNativeHost Host() noexcept; - virtual void OnLaunched(Activation::LaunchActivatedEventArgs const &); - virtual void OnSuspending(IInspectable const &, SuspendingEventArgs const &); - virtual void OnNavigationFailed(IInspectable const &, NavigationFailedEventArgs const &); + virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const &); + virtual void OnSuspending(IInspectable const &, Windows::ApplicationModel::SuspendingEventArgs const &); + virtual void OnNavigationFailed( + IInspectable const &, + Windows::UI::Xaml::Navigation::NavigationFailedEventArgs const &); protected: virtual ReactApplicationDelegate __stdcall CreateReactApplicationDelegate(); private: - Microsoft::ReactNative::ReactInstanceSettings m_instanceSettings{nullptr}; - IVector m_packageProviders{nullptr}; + ReactNative::ReactInstanceSettings m_instanceSettings{nullptr}; + Windows::Foundation::Collections::IVector m_packageProviders{nullptr}; hstring m_mainComponentName; bool m_useDeveloperSupport{REACT_DEFAULT_USE_DEVELOPER_SUPPORT}; hstring m_javaScriptMainModuleName; hstring m_javaScriptBundleFile; - Microsoft::ReactNative::ReactNativeHost m_host{nullptr}; + ReactNative::ReactNativeHost m_host{nullptr}; ReactApplicationDelegate m_delegate{nullptr}; - void OnCreate(Activation::LaunchActivatedEventArgs const &e); + void OnCreate(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const &e); }; } // namespace winrt::Microsoft::ReactNative::implementation @@ -72,11 +68,12 @@ namespace winrt::Microsoft::ReactNative::implementation { // ReactApplication inline implementation //============================================================================= -inline void ReactApplication::InstanceSettings(Microsoft::ReactNative::ReactInstanceSettings const &value) noexcept { +inline void ReactApplication::InstanceSettings(ReactNative::ReactInstanceSettings const &value) noexcept { m_instanceSettings = value; } -inline void ReactApplication::PackageProviders(IVector const &value) noexcept { +inline void ReactApplication::PackageProviders( + Windows::Foundation::Collections::IVector const &value) noexcept { m_packageProviders = value; } diff --git a/vnext/Microsoft.ReactNative/ReactApplication.idl b/vnext/Microsoft.ReactNative/ReactApplication.idl index a778c4f7ec7..1c505350fec 100644 --- a/vnext/Microsoft.ReactNative/ReactApplication.idl +++ b/vnext/Microsoft.ReactNative/ReactApplication.idl @@ -4,23 +4,22 @@ import "ReactNativeHost.idl"; import "ReactApplicationDelegate.idl"; -namespace Microsoft.ReactNative -{ - [webhosthidden] - [default_interface] - unsealed runtimeclass ReactApplication : Windows.UI.Xaml.Application - { - ReactApplication(); +namespace Microsoft.ReactNative { + + [webhosthidden] + [default_interface] + unsealed runtimeclass ReactApplication : Windows.UI.Xaml.Application { + ReactApplication(); - ReactInstanceSettings InstanceSettings { get; set; }; + ReactInstanceSettings InstanceSettings { get; set; }; - IVector PackageProviders { get; set; }; + IVector PackageProviders { get; set; }; - String MainComponentName { get; set; }; - Boolean UseDeveloperSupport { get; set; }; - String JavaScriptMainModuleName { get; set; }; - String JavaScriptBundleFile { get; set; }; + String MainComponentName { get; set; }; + Boolean UseDeveloperSupport { get; set; }; + String JavaScriptMainModuleName { get; set; }; + String JavaScriptBundleFile { get; set; }; - ReactNativeHost Host { get; }; - }; + ReactNativeHost Host { get; }; + } } // namespace Microsoft.ReactNative diff --git a/vnext/Microsoft.ReactNative/ReactApplicationDelegate.cpp b/vnext/Microsoft.ReactNative/ReactApplicationDelegate.cpp index fd8784bf9eb..86a2ffa0942 100644 --- a/vnext/Microsoft.ReactNative/ReactApplicationDelegate.cpp +++ b/vnext/Microsoft.ReactNative/ReactApplicationDelegate.cpp @@ -3,18 +3,18 @@ #include "pch.h" #include "ReactApplicationDelegate.h" -#if __has_include("ReactApplicationDelegate.g.cpp") #include "ReactApplicationDelegate.g.cpp" -#endif #include "ReactNativeHost.h" using namespace winrt; using namespace Windows::Foundation; using namespace Windows::UI::Xaml; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Activation; -namespace { +namespace winrt::Microsoft::ReactNative::implementation { -static void ApplyArguments(winrt::Microsoft::ReactNative::ReactNativeHost host, std::wstring arguments) { +static void ApplyArguments(ReactNative::ReactNativeHost const &host, std::wstring const &arguments) noexcept { // Microsoft::ReactNative::implementation::ReactNativeHost* hostImpl { // get_self(host)}; if (!arguments.empty() && host.HasInstance()) { @@ -23,10 +23,9 @@ static void ApplyArguments(winrt::Microsoft::ReactNative::ReactNativeHost host, // ReactInstanceManager.DevSupportManager.IsRemoteDebuggingEnabled flag } } -} // namespace -namespace winrt::Microsoft::ReactNative::implementation { -ReactApplicationDelegate::ReactApplicationDelegate(Application const &application) : m_application(application) { +ReactApplicationDelegate::ReactApplicationDelegate(Application const &application) noexcept + : m_application(application) { if (application == nullptr) { throw winrt::hresult_null_argument(); // ArgumentNullException } @@ -42,8 +41,7 @@ ReactApplicationDelegate::ReactApplicationDelegate(Application const &applicatio m_application.EnteredBackground({this, &ReactApplicationDelegate::OnEnteredBackground}); } -void ReactApplicationDelegate::OnActivated( - winrt::Windows::ApplicationModel::Activation::IActivatedEventArgs const &args) { +void ReactApplicationDelegate::OnActivated(IActivatedEventArgs const &args) noexcept { switch (args.Kind()) { case ActivationKind::Protocol: auto protocolArgs = args.as(); @@ -66,7 +64,7 @@ void ReactApplicationDelegate::OnActivated( } // Create the root view for the ReactNative app -UIElement ReactApplicationDelegate::OnCreate(hstring const &arguments) { +UIElement ReactApplicationDelegate::OnCreate(hstring const &arguments) noexcept { auto host = m_reactApplication.Host(); host.OnResume([=]() { m_application.Exit(); }); @@ -74,28 +72,29 @@ UIElement ReactApplicationDelegate::OnCreate(hstring const &arguments) { return host.GetOrCreateRootView(nullptr); } -void ReactApplicationDelegate::OnResuming(IInspectable sender, IInspectable args) { +void ReactApplicationDelegate::OnResuming(IInspectable const &sender, IInspectable const &args) noexcept { m_reactApplication.Host().OnResume([=]() { m_application.Exit(); }); OutputDebugStringW(L"ReactApplicationDelegate::OnResuming"); } -void ReactApplicationDelegate::OnSuspending(IInspectable sender, IInspectable args) { +void ReactApplicationDelegate::OnSuspending(IInspectable const &sender, IInspectable const &args) noexcept { OutputDebugStringW(L"ReactApplicationDelegate::OnSuspending"); m_reactApplication.Host().OnSuspend(); } void ReactApplicationDelegate::OnLeavingBackground( - IInspectable sender, - winrt::Windows::ApplicationModel::LeavingBackgroundEventArgs args) { + IInspectable const &sender, + LeavingBackgroundEventArgs const &args) noexcept { OutputDebugStringW(L"ReactApplicationDelegate::OnLeavingBackground"); m_reactApplication.Host().OnLeavingBackground(); } void ReactApplicationDelegate::OnEnteredBackground( - IInspectable sender, - winrt::Windows::ApplicationModel::EnteredBackgroundEventArgs args) { + IInspectable const &sender, + EnteredBackgroundEventArgs const &args) noexcept { OutputDebugStringW(L"ReactApplicationDelegate::OnEnteredBackground"); m_reactApplication.Host().OnEnteredBackground(); } + } // namespace winrt::Microsoft::ReactNative::implementation diff --git a/vnext/Microsoft.ReactNative/ReactApplicationDelegate.h b/vnext/Microsoft.ReactNative/ReactApplicationDelegate.h index 620b4ac67d2..df4eea6ddd1 100644 --- a/vnext/Microsoft.ReactNative/ReactApplicationDelegate.h +++ b/vnext/Microsoft.ReactNative/ReactApplicationDelegate.h @@ -4,28 +4,30 @@ #include "ReactApplicationDelegate.g.h" -using namespace winrt; -using namespace Windows::UI::Xaml; -using namespace Windows::ApplicationModel; -using namespace Windows::ApplicationModel::Activation; - namespace winrt::Microsoft::ReactNative::implementation { + struct ReactApplicationDelegate : ReactApplicationDelegateT { ReactApplicationDelegate() = default; - ReactApplicationDelegate(Application const &application); + ReactApplicationDelegate(Windows::UI::Xaml::Application const &application) noexcept; - void OnActivated(winrt::Windows::ApplicationModel::Activation::IActivatedEventArgs const &args); - UIElement OnCreate(hstring const &args); + void OnActivated(Windows::ApplicationModel::Activation::IActivatedEventArgs const &args) noexcept; + Windows::UI::Xaml::UIElement OnCreate(hstring const &args) noexcept; private: - Application m_application{nullptr}; - winrt::Microsoft::ReactNative::IReactApplication m_reactApplication{nullptr}; + void OnResuming(IInspectable const &sender, IInspectable const &args) noexcept; + void OnSuspending(IInspectable const &sender, IInspectable const &args) noexcept; + void OnLeavingBackground( + IInspectable const &sender, + Windows::ApplicationModel::LeavingBackgroundEventArgs const &args) noexcept; + void OnEnteredBackground( + IInspectable const &sender, + Windows::ApplicationModel::EnteredBackgroundEventArgs const &args) noexcept; - void OnResuming(IInspectable sender, IInspectable args); - void OnSuspending(IInspectable sender, IInspectable args); - void OnLeavingBackground(IInspectable sender, winrt::Windows::ApplicationModel::LeavingBackgroundEventArgs args); - void OnEnteredBackground(IInspectable sender, winrt::Windows::ApplicationModel::EnteredBackgroundEventArgs args); + private: + Windows::UI::Xaml::Application m_application{nullptr}; + IReactApplication m_reactApplication{nullptr}; }; + } // namespace winrt::Microsoft::ReactNative::implementation namespace winrt::Microsoft::ReactNative::factory_implementation { diff --git a/vnext/Microsoft.ReactNative/ReactInstance.cpp b/vnext/Microsoft.ReactNative/ReactInstance.cpp index e653eccf7f5..d55bcadbebc 100644 --- a/vnext/Microsoft.ReactNative/ReactInstance.cpp +++ b/vnext/Microsoft.ReactNative/ReactInstance.cpp @@ -3,20 +3,16 @@ #include "pch.h" #include "ReactInstance.h" -#if __has_include("Bridge.ReactInstance.g.cpp") -#include "Bridge.ReactInstance.g.cpp" -#endif - +#include "ReactInstance.g.cpp" #include "ReactSupport.h" -namespace winrt::Microsoft::ReactNative::Bridge::implementation { +namespace winrt::Microsoft::ReactNative::implementation { void ReactInstance::InvokeFunction( hstring const &moduleName, hstring const &method, - IVectorView const &arguments) { - folly::dynamic args = Microsoft::ReactNative::Bridge::ConvertToDynamic(arguments); - + Windows::Foundation::Collections::IVectorView const &arguments) { + folly::dynamic args{ConvertToDynamic(arguments)}; m_instance->CallJsFunction(to_string(moduleName), to_string(method), std::move(args)); } -} // namespace winrt::Microsoft::ReactNative::Bridge::implementation +} // namespace winrt::Microsoft::ReactNative::implementation diff --git a/vnext/Microsoft.ReactNative/ReactInstance.h b/vnext/Microsoft.ReactNative/ReactInstance.h index 7a2e16a7abf..7b7e83efd03 100644 --- a/vnext/Microsoft.ReactNative/ReactInstance.h +++ b/vnext/Microsoft.ReactNative/ReactInstance.h @@ -1,17 +1,14 @@ -#pragma once // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#include "Bridge.ReactInstance.g.h" +#pragma once + +#include "ReactInstance.g.h" #include #include -using namespace winrt; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; - -namespace winrt::Microsoft::ReactNative::Bridge::implementation { +namespace winrt::Microsoft::ReactNative::implementation { struct ReactInstance : ReactInstanceT { ReactInstance() = default; @@ -21,13 +18,16 @@ struct ReactInstance : ReactInstanceT { } } - void InvokeFunction(hstring const &moduleName, hstring const &method, IVectorView const &arguments); + void InvokeFunction( + hstring const &moduleName, + hstring const &method, + Windows::Foundation::Collections::IVectorView const &arguments); private: std::shared_ptr m_instance{nullptr}; }; -} // namespace winrt::Microsoft::ReactNative::Bridge::implementation +} // namespace winrt::Microsoft::ReactNative::implementation -namespace winrt::Microsoft::ReactNative::Bridge::factory_implementation { +namespace winrt::Microsoft::ReactNative::factory_implementation { struct ReactInstance : ReactInstanceT {}; -} // namespace winrt::Microsoft::ReactNative::Bridge::factory_implementation +} // namespace winrt::Microsoft::ReactNative::factory_implementation diff --git a/vnext/Microsoft.ReactNative/ReactInstance.idl b/vnext/Microsoft.ReactNative/ReactInstance.idl index 9342e8ec19e..c501a2781f4 100644 --- a/vnext/Microsoft.ReactNative/ReactInstance.idl +++ b/vnext/Microsoft.ReactNative/ReactInstance.idl @@ -1,17 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -namespace Microsoft.ReactNative.Bridge -{ - interface IReactInstance - { +namespace Microsoft.ReactNative { + + [webhosthidden] + interface IReactInstance { void InvokeFunction(String moduleName, String method, IVectorView arguments); - }; + } [webhosthidden] [default_interface] - runtimeclass ReactInstance : IReactInstance - { + runtimeclass ReactInstance : IReactInstance { ReactInstance(); - }; -} + } +} // namespace Microsoft.ReactNative diff --git a/vnext/Microsoft.ReactNative/ReactInstanceCreator.cpp b/vnext/Microsoft.ReactNative/ReactInstanceCreator.cpp index 1347e51e1dd..a8b843037a8 100644 --- a/vnext/Microsoft.ReactNative/ReactInstanceCreator.cpp +++ b/vnext/Microsoft.ReactNative/ReactInstanceCreator.cpp @@ -5,9 +5,6 @@ #include "ReactInstanceCreator.h" #include -using namespace winrt; -using namespace winrt::Microsoft::ReactNative::Bridge; - namespace winrt::Microsoft::ReactNative::implementation { void InitReactNative() { @@ -20,11 +17,11 @@ void InitReactNative() { } ReactInstanceCreator::ReactInstanceCreator( - Microsoft::ReactNative::ReactInstanceSettings instanceSettings, - std::string jsBundleFile, - std::string jsMainModuleName, - std::shared_ptr modulesProvider, - std::shared_ptr viewManagersProvider) + ReactNative::ReactInstanceSettings const &instanceSettings, + std::string const &jsBundleFile, + std::string const &jsMainModuleName, + std::shared_ptr const &modulesProvider, + std::shared_ptr const &viewManagersProvider) : m_instanceSettings(instanceSettings), m_jsBundleFile(jsBundleFile), m_jsMainModuleName(jsMainModuleName), @@ -86,4 +83,5 @@ void ReactInstanceCreator::markAsNeedsReload() { m_instance->SetAsNeedsReload(); m_instance = nullptr; } + } // namespace winrt::Microsoft::ReactNative::implementation diff --git a/vnext/Microsoft.ReactNative/ReactInstanceCreator.h b/vnext/Microsoft.ReactNative/ReactInstanceCreator.h index 94790d7a429..2a85589bd1b 100644 --- a/vnext/Microsoft.ReactNative/ReactInstanceCreator.h +++ b/vnext/Microsoft.ReactNative/ReactInstanceCreator.h @@ -10,20 +10,17 @@ #include #include -using namespace winrt; -using namespace Microsoft::ReactNative; -using namespace Microsoft::ReactNative::Bridge; - namespace winrt::Microsoft::ReactNative::implementation { + void InitReactNative(); struct ReactInstanceCreator : react::uwp::IReactInstanceCreator { ReactInstanceCreator( - Microsoft::ReactNative::ReactInstanceSettings instanceSettings, - std::string jsBundleFile, - std::string jsMainModuleName, - std::shared_ptr modulesProvider, - std::shared_ptr viewManagersProvider); + ReactNative::ReactInstanceSettings const &instanceSettings, + std::string const &jsBundleFile, + std::string const &jsMainModuleName, + std::shared_ptr const &modulesProvider, + std::shared_ptr const &viewManagersProvider); std::string m_jsMainModuleName{}; std::string m_jsBundleFile{}; @@ -42,7 +39,7 @@ struct ReactInstanceCreator : react::uwp::IReactInstanceCreator { }; private: - Microsoft::ReactNative::ReactInstanceSettings m_instanceSettings{}; + ReactNative::ReactInstanceSettings m_instanceSettings{}; std::shared_ptr m_instance; }; } // namespace winrt::Microsoft::ReactNative::implementation diff --git a/vnext/Microsoft.ReactNative/ReactInstanceManager.cpp b/vnext/Microsoft.ReactNative/ReactInstanceManager.cpp index 042d1f6e5e6..d620dddd806 100644 --- a/vnext/Microsoft.ReactNative/ReactInstanceManager.cpp +++ b/vnext/Microsoft.ReactNative/ReactInstanceManager.cpp @@ -14,19 +14,17 @@ #include #include -using namespace winrt; -using namespace winrt::Microsoft::ReactNative; -using namespace winrt::Microsoft::ReactNative::Bridge; using namespace winrt::Windows::Foundation::Collections; namespace winrt::Microsoft::ReactNative::implementation { + ReactInstanceManager::ReactInstanceManager( - Microsoft::ReactNative::ReactInstanceSettings instanceSettings, - std::string jsBundleFile, - std::string jsMainModuleName, - IVectorView &packageProviders, + ReactNative::ReactInstanceSettings const &instanceSettings, + std::string const &jsBundleFile, + std::string const &jsMainModuleName, + IVectorView const &packageProviders, bool useDeveloperSupport, - /*TODO*/ LifecycleState /*initialLifecycleState*/) + /*TODO*/ LifecycleState const & /*initialLifecycleState*/) : m_instanceSettings(instanceSettings), m_jsBundleFile(jsBundleFile), m_jsMainModuleName(jsMainModuleName), @@ -175,8 +173,7 @@ auto ReactInstanceManager::CreateReactContextCoreAsync() -> IAsyncOperationgetInstance(); - auto reactContext = - winrt::make(reactInstance).as(); + auto reactContext = winrt::make(reactInstance).as(); // TODO: Investigate whether we need the equivalent of the // LimitedConcurrencyActionQueue from the C# implementation that is used to diff --git a/vnext/Microsoft.ReactNative/ReactInstanceManager.h b/vnext/Microsoft.ReactNative/ReactInstanceManager.h index 2c3273042cf..ab76b296107 100644 --- a/vnext/Microsoft.ReactNative/ReactInstanceManager.h +++ b/vnext/Microsoft.ReactNative/ReactInstanceManager.h @@ -13,22 +13,17 @@ #include #include -using namespace winrt; -using namespace Microsoft::ReactNative::Bridge; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; - namespace winrt::Microsoft::ReactNative::implementation { struct ReactInstanceManager : ReactInstanceManagerT { ReactInstanceManager() = default; ReactInstanceManager( - Microsoft::ReactNative::ReactInstanceSettings instanceSettings, - std::string jsBundleFile, - std::string jsMainModuleName, - IVectorView &packageProviders, + ReactNative::ReactInstanceSettings const &instanceSettings, + std::string const &jsBundleFile, + std::string const &jsMainModuleName, + Windows::Foundation::Collections::IVectorView const &packageProviders, bool useDeveloperSupport, - LifecycleState initialLifecycleState); + LifecycleState const &initialLifecycleState); IAsyncOperation GetOrCreateReactContextAsync(); IReactContext CurrentReactContext() { @@ -52,7 +47,7 @@ struct ReactInstanceManager : ReactInstanceManagerT { private: IReactContext m_currentReactContext{nullptr}; - Microsoft::ReactNative::ReactInstanceSettings m_instanceSettings{nullptr}; + ReactNative::ReactInstanceSettings m_instanceSettings{nullptr}; std::string m_jsBundleFile{}; std::string m_jsMainModuleName{}; std::vector m_packageProviders; diff --git a/vnext/Microsoft.ReactNative/ReactInstanceManager.idl b/vnext/Microsoft.ReactNative/ReactInstanceManager.idl index d6ee849e912..ec6701c2006 100644 --- a/vnext/Microsoft.ReactNative/ReactInstanceManager.idl +++ b/vnext/Microsoft.ReactNative/ReactInstanceManager.idl @@ -4,17 +4,16 @@ import "ReactNativeHost.idl"; import "IReactContext.idl"; -namespace Microsoft.ReactNative -{ - [webhosthidden] - runtimeclass ReactInstanceManager - { - ReactInstanceManager(); - Microsoft.ReactNative.Bridge.IReactContext CurrentReactContext(); - void OnSuspend(); - void OnEnteredBackground(); - void OnLeavingBackground(); - void OnResume(OnResumeAction action); - void OnBackPressed(); - } -} +namespace Microsoft.ReactNative { + + [webhosthidden] + runtimeclass ReactInstanceManager { + ReactInstanceManager(); + IReactContext CurrentReactContext(); + void OnSuspend(); + void OnEnteredBackground(); + void OnLeavingBackground(); + void OnResume(OnResumeAction action); + void OnBackPressed(); + } +} // namespace Microsoft.ReactNative diff --git a/vnext/Microsoft.ReactNative/ReactInstanceManagerBuilder.cpp b/vnext/Microsoft.ReactNative/ReactInstanceManagerBuilder.cpp index 0e05307830c..7965ac5c12e 100644 --- a/vnext/Microsoft.ReactNative/ReactInstanceManagerBuilder.cpp +++ b/vnext/Microsoft.ReactNative/ReactInstanceManagerBuilder.cpp @@ -4,12 +4,9 @@ #include "pch.h" #include "ReactInstanceManagerBuilder.h" -using namespace winrt; -using namespace Microsoft::ReactNative; - namespace winrt::Microsoft::ReactNative::implementation { -winrt::Microsoft::ReactNative::ReactInstanceManager ReactInstanceManagerBuilder::Build() { +ReactNative::ReactInstanceManager ReactInstanceManagerBuilder::Build() { if (!m_isLifecycleStateSet) { throw hresult_invalid_operation(L"Initial lifecycle state was not set."); } diff --git a/vnext/Microsoft.ReactNative/ReactInstanceManagerBuilder.h b/vnext/Microsoft.ReactNative/ReactInstanceManagerBuilder.h index a768f78629a..5f473d5b9a1 100644 --- a/vnext/Microsoft.ReactNative/ReactInstanceManagerBuilder.h +++ b/vnext/Microsoft.ReactNative/ReactInstanceManagerBuilder.h @@ -6,9 +6,6 @@ #include "ReactInstanceManager.h" #include "ReactInstanceSettings.h" -using namespace winrt; -using namespace Microsoft::ReactNative; - namespace winrt::Microsoft::ReactNative::implementation { class ReactInstanceManagerBuilder { public: @@ -22,11 +19,11 @@ class ReactInstanceManagerBuilder { m_useDeveloperSupport = useDevSupport; }; - Microsoft::ReactNative::ReactInstanceSettings InstanceSettings() { + ReactNative::ReactInstanceSettings InstanceSettings() { return m_instanceSettings; } - void InstanceSettings(Microsoft::ReactNative::ReactInstanceSettings const &settings) { + void InstanceSettings(ReactNative::ReactInstanceSettings const &settings) { m_instanceSettings = settings; } @@ -35,15 +32,15 @@ class ReactInstanceManagerBuilder { m_isLifecycleStateSet = TRUE; }; - void PackageProviders(IVectorView const &packageProviders) { + void PackageProviders(Windows::Foundation::Collections::IVectorView const &packageProviders) { m_packageProviders = packageProviders; } - Microsoft::ReactNative::ReactInstanceManager Build(); + ReactNative::ReactInstanceManager Build(); private: Windows::Foundation::Collections::IVectorView m_packageProviders; - Microsoft::ReactNative::ReactInstanceSettings m_instanceSettings{nullptr}; + ReactNative::ReactInstanceSettings m_instanceSettings{nullptr}; std::wstring m_jsBundleFile{}; std::wstring m_jsMainModuleName{}; bool m_useDeveloperSupport{false}; diff --git a/vnext/Microsoft.ReactNative/ReactInstanceSettings.h b/vnext/Microsoft.ReactNative/ReactInstanceSettings.h index 78874da5efc..6fcff632cc1 100644 --- a/vnext/Microsoft.ReactNative/ReactInstanceSettings.h +++ b/vnext/Microsoft.ReactNative/ReactInstanceSettings.h @@ -88,17 +88,17 @@ struct ReactInstanceSettings : ReactInstanceSettingsT { // TODO: Discuss whether this is where we should have these set by default // versus in the new project template. This makes it easier for a // debug build to work out of the box. - bool m_useWebDebugger{TRUE}; - bool m_useLiveReload{TRUE}; + bool m_useWebDebugger{true}; + bool m_useLiveReload{true}; #else - bool m_useWebDebugger{FALSE}; - bool m_useLiveReload{FALSE}; + bool m_useWebDebugger{false}; + bool m_useLiveReload{false}; #endif - bool m_enableDeveloperMenu{FALSE}; - bool m_useDirectDebugger{FALSE}; - bool m_useJsi{TRUE}; - bool m_enableJITCompilation{TRUE}; - bool m_enableByteCodeCaching{FALSE}; + bool m_enableDeveloperMenu{false}; + bool m_useDirectDebugger{false}; + bool m_useJsi{true}; + bool m_enableJITCompilation{true}; + bool m_enableByteCodeCaching{false}; hstring m_byteCodeFileUri{}; hstring m_debugHost{}; diff --git a/vnext/Microsoft.ReactNative/ReactNativeHost.cpp b/vnext/Microsoft.ReactNative/ReactNativeHost.cpp index d6320ffbbb1..848b949a532 100644 --- a/vnext/Microsoft.ReactNative/ReactNativeHost.cpp +++ b/vnext/Microsoft.ReactNative/ReactNativeHost.cpp @@ -16,6 +16,7 @@ #include using namespace winrt; +using namespace Windows::Foundation::Collections; using namespace Windows::UI::Xaml; using namespace Windows::UI::Xaml::Controls; @@ -34,7 +35,7 @@ void ReactNativeHost::Init() noexcept { #endif } -Microsoft::ReactNative::ReactInstanceManager ReactNativeHost::CreateReactInstanceManager() noexcept { +ReactNative::ReactInstanceManager ReactNativeHost::CreateReactInstanceManager() noexcept { auto builder = ReactInstanceManagerBuilder(); builder.InstanceSettings(InstanceSettings()); builder.UseDeveloperSupport(UseDeveloperSupport()); @@ -51,7 +52,7 @@ std::shared_ptr ReactNativeHost::CreateRootView() noexcept { return rootView; } -Microsoft::ReactNative::ReactInstanceManager ReactNativeHost::ReactInstanceManager() noexcept { +ReactNative::ReactInstanceManager ReactNativeHost::ReactInstanceManager() noexcept { if (m_reactInstanceManager == nullptr) { m_reactInstanceManager = CreateReactInstanceManager(); } @@ -64,7 +65,7 @@ UIElement ReactNativeHost::GetOrCreateRootView(IInspectable initialProps) noexce return *m_reactRootView; } - folly::dynamic props = Microsoft::ReactNative::Bridge::ConvertToDynamic(initialProps); + folly::dynamic props = ConvertToDynamic(initialProps); m_reactRootView = CreateRootView(); assert(m_reactRootView != nullptr); @@ -75,7 +76,7 @@ UIElement ReactNativeHost::GetOrCreateRootView(IInspectable initialProps) noexce return *m_reactRootView; } -auto ReactNativeHost::InstanceSettings() noexcept -> Microsoft::ReactNative::ReactInstanceSettings { +ReactNative::ReactInstanceSettings ReactNativeHost::InstanceSettings() noexcept { if (!m_instanceSettings) { m_instanceSettings = make(); m_instanceSettings.UseWebDebugger(false); @@ -113,7 +114,7 @@ void ReactNativeHost::OnLeavingBackground() noexcept { } } -void ReactNativeHost::OnResume(Microsoft::ReactNative::OnResumeAction const &action) noexcept { +void ReactNativeHost::OnResume(OnResumeAction const &action) noexcept { if (HasInstance()) { ReactInstanceManager().OnResume(action); } diff --git a/vnext/Microsoft.ReactNative/ReactNativeHost.h b/vnext/Microsoft.ReactNative/ReactNativeHost.h index 25acac58429..473b0937ba5 100644 --- a/vnext/Microsoft.ReactNative/ReactNativeHost.h +++ b/vnext/Microsoft.ReactNative/ReactNativeHost.h @@ -12,11 +12,6 @@ #include #include -using namespace winrt; -using namespace Microsoft::ReactNative; -using namespace Microsoft::ReactNative::Bridge; -using namespace Windows::Foundation::Collections; - #ifndef REACT_DEFAULT_USE_DEVELOPER_SUPPORT #if _DEBUG #define REACT_DEFAULT_USE_DEVELOPER_SUPPORT true @@ -40,12 +35,12 @@ struct ReactNativeHost : ReactNativeHostT { UIElement GetOrCreateRootView(IInspectable initialProps) noexcept; - Microsoft::ReactNative::ReactInstanceManager ReactInstanceManager() noexcept; - Microsoft::ReactNative::ReactInstanceSettings InstanceSettings() noexcept; - void InstanceSettings(Microsoft::ReactNative::ReactInstanceSettings const &value) noexcept; + ReactNative::ReactInstanceManager ReactInstanceManager() noexcept; + ReactNative::ReactInstanceSettings InstanceSettings() noexcept; + void InstanceSettings(ReactNative::ReactInstanceSettings const &value) noexcept; bool HasInstance() noexcept; - IVector PackageProviders() noexcept; - void PackageProviders(IVector const &value) noexcept; + Windows::Foundation::Collections::IVector PackageProviders() noexcept; + void PackageProviders(Windows::Foundation::Collections::IVector const &value) noexcept; hstring MainComponentName() noexcept; void MainComponentName(hstring const &value) noexcept; bool UseDeveloperSupport() noexcept; @@ -62,13 +57,13 @@ struct ReactNativeHost : ReactNativeHostT { private: void Init() noexcept; - Microsoft::ReactNative::ReactInstanceManager CreateReactInstanceManager() noexcept; + ReactNative::ReactInstanceManager CreateReactInstanceManager() noexcept; std::shared_ptr CreateRootView() noexcept; private: - Microsoft::ReactNative::ReactInstanceSettings m_instanceSettings; - Microsoft::ReactNative::ReactInstanceManager m_reactInstanceManager{nullptr}; - IVector m_packageProviders{nullptr}; + ReactNative::ReactInstanceSettings m_instanceSettings; + ReactNative::ReactInstanceManager m_reactInstanceManager{nullptr}; + Windows::Foundation::Collections::IVector m_packageProviders{nullptr}; hstring m_mainComponentName; bool m_useDeveloperSupport{REACT_DEFAULT_USE_DEVELOPER_SUPPORT}; hstring m_javaScriptMainModuleName; @@ -91,7 +86,7 @@ namespace winrt::Microsoft::ReactNative::implementation { // ReactNativeHost inline implementation //============================================================================= -inline void ReactNativeHost::InstanceSettings(Microsoft::ReactNative::ReactInstanceSettings const &value) noexcept { +inline void ReactNativeHost::InstanceSettings(ReactNative::ReactInstanceSettings const &value) noexcept { m_instanceSettings = value; } @@ -99,7 +94,8 @@ inline bool ReactNativeHost::HasInstance() noexcept { return m_reactInstanceManager != nullptr; } -inline void ReactNativeHost::PackageProviders(IVector const &value) noexcept { +inline void ReactNativeHost::PackageProviders( + Windows::Foundation::Collections::IVector const &value) noexcept { m_packageProviders = value; } diff --git a/vnext/Microsoft.ReactNative/ReactNativeHost.idl b/vnext/Microsoft.ReactNative/ReactNativeHost.idl index e6edc632fb5..c0d9f2208cc 100644 --- a/vnext/Microsoft.ReactNative/ReactNativeHost.idl +++ b/vnext/Microsoft.ReactNative/ReactNativeHost.idl @@ -6,15 +6,14 @@ import "ReactInstanceManager.idl"; import "ReactInstanceSettings.idl"; import "ReactRootView.idl"; -namespace Microsoft.ReactNative -{ +namespace Microsoft.ReactNative { + [webhosthidden] delegate void OnResumeAction(); [webhosthidden] [default_interface] - runtimeclass ReactNativeHost - { + runtimeclass ReactNativeHost { ReactNativeHost(); ReactInstanceManager ReactInstanceManager{ get; }; @@ -22,7 +21,7 @@ namespace Microsoft.ReactNative Boolean HasInstance{ get; }; - IVector PackageProviders { get; set; }; + IVector PackageProviders { get; set; }; String MainComponentName{ get; set; }; Boolean UseDeveloperSupport{ get; set; }; @@ -35,5 +34,5 @@ namespace Microsoft.ReactNative void OnEnteredBackground(); void OnLeavingBackground(); void OnResume(OnResumeAction action); - }; -} + } +} // namespace Microsoft.ReactNative diff --git a/vnext/Microsoft.ReactNative/ReactPackageBuilder.cpp b/vnext/Microsoft.ReactNative/ReactPackageBuilder.cpp index 2b131b393d6..3fb37ef79a1 100644 --- a/vnext/Microsoft.ReactNative/ReactPackageBuilder.cpp +++ b/vnext/Microsoft.ReactNative/ReactPackageBuilder.cpp @@ -4,7 +4,7 @@ #include "pch.h" #include "ReactPackageBuilder.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { //=========================================================================== // ReactPackageBuilder implementation @@ -25,4 +25,4 @@ void ReactPackageBuilder::AddViewManager( m_viewManagersProvider->AddViewManagerProvider(viewManagerName, viewManagerProvider); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/ReactPackageBuilder.h b/vnext/Microsoft.ReactNative/ReactPackageBuilder.h index 7188eddf740..23c76e17761 100644 --- a/vnext/Microsoft.ReactNative/ReactPackageBuilder.h +++ b/vnext/Microsoft.ReactNative/ReactPackageBuilder.h @@ -4,9 +4,9 @@ #include "NativeModulesProvider.h" #include "ViewManagersProvider.h" -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { struct ReactPackageBuilder : winrt::implements { ReactPackageBuilder( @@ -22,4 +22,4 @@ struct ReactPackageBuilder : winrt::implements m_viewManagersProvider; }; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/ReactRootView.cpp b/vnext/Microsoft.ReactNative/ReactRootView.cpp index 09d22014496..49b54d2d83f 100644 --- a/vnext/Microsoft.ReactNative/ReactRootView.cpp +++ b/vnext/Microsoft.ReactNative/ReactRootView.cpp @@ -10,7 +10,11 @@ using namespace Windows::UI::Core; using namespace Windows::UI::Xaml; namespace winrt::Microsoft::ReactNative::implementation { -void ReactRootView::OnCreate(Microsoft::ReactNative::ReactNativeHost const &host) { + +bool s_isShiftKeyDown = false; +bool s_isControlKeyDown = false; + +void ReactRootView::OnCreate(ReactNative::ReactNativeHost const &host) { auto resources = Application::Current().Resources(); auto brush = resources.Lookup(box_value(L"ApplicationPageBackgroundThemeBrush")).as(); this->Background(brush); @@ -29,7 +33,7 @@ void ReactRootView::OnCreate(Microsoft::ReactNative::ReactNativeHost const &host } fire_and_forget ReactRootView::StartReactApplicationAsync( - Microsoft::ReactNative::ReactInstanceManager const &instanceManager, + ReactNative::ReactInstanceManager const &instanceManager, hstring componentName, folly::dynamic initialProps) { if (!Dispatcher().HasThreadAccess()) { diff --git a/vnext/Microsoft.ReactNative/ReactRootView.h b/vnext/Microsoft.ReactNative/ReactRootView.h index 24e1060c6ea..1c1b9bcca19 100644 --- a/vnext/Microsoft.ReactNative/ReactRootView.h +++ b/vnext/Microsoft.ReactNative/ReactRootView.h @@ -12,13 +12,10 @@ #include #include -using namespace winrt; -using namespace Windows::UI::Core; - namespace winrt::Microsoft::ReactNative::implementation { -static bool s_isShiftKeyDown; -static bool s_isControlKeyDown; +extern bool s_isShiftKeyDown; +extern bool s_isControlKeyDown; struct ReactRootView : ReactRootViewT { ReactRootView() = default; @@ -38,14 +35,14 @@ struct ReactRootView : ReactRootViewT { static void OnBackRequested( ReactNative::ReactNativeHost const &host, IInspectable const &sender, - BackRequestedEventArgs const &e); + Windows::UI::Core::BackRequestedEventArgs const &e); static void OnAcceleratorKeyActivated( ReactNative::ReactNativeHost const &host, - CoreDispatcher const &sender, - AcceleratorKeyEventArgs const &e); + Windows::UI::Core::CoreDispatcher const &sender, + Windows::UI::Core::AcceleratorKeyEventArgs const &e); - static bool IsKeyDown(CoreAcceleratorKeyEventType t); + static bool IsKeyDown(Windows::UI::Core::CoreAcceleratorKeyEventType t); }; } // namespace winrt::Microsoft::ReactNative::implementation diff --git a/vnext/Microsoft.ReactNative/ReactRootView.idl b/vnext/Microsoft.ReactNative/ReactRootView.idl index 9989fe99d20..ad248f43f9e 100644 --- a/vnext/Microsoft.ReactNative/ReactRootView.idl +++ b/vnext/Microsoft.ReactNative/ReactRootView.idl @@ -1,12 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -namespace Microsoft.ReactNative -{ - [default_interface] - [webhosthidden] - runtimeclass ReactRootView : Windows.UI.Xaml.Controls.Grid - { - ReactRootView(); - } -} +namespace Microsoft.ReactNative { + + [default_interface] + [webhosthidden] + runtimeclass ReactRootView : Windows.UI.Xaml.Controls.Grid { + ReactRootView(); + } +} // namespace Microsoft.ReactNative diff --git a/vnext/Microsoft.ReactNative/ReactSupport.cpp b/vnext/Microsoft.ReactNative/ReactSupport.cpp index f12f5631636..89a3b06dbc4 100644 --- a/vnext/Microsoft.ReactNative/ReactSupport.cpp +++ b/vnext/Microsoft.ReactNative/ReactSupport.cpp @@ -6,7 +6,7 @@ using namespace winrt; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { folly::dynamic ConvertToDynamic(IInspectable const &object) { if (object == nullptr) @@ -218,4 +218,4 @@ IInspectable ConvertToIInspectable(folly::dynamic const &object) { } } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/ReactSupport.h b/vnext/Microsoft.ReactNative/ReactSupport.h index 714e7994270..8f47ff0e7e2 100644 --- a/vnext/Microsoft.ReactNative/ReactSupport.h +++ b/vnext/Microsoft.ReactNative/ReactSupport.h @@ -1,20 +1,18 @@ -#pragma once // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +#pragma once + #include "pch.h" #include #include #include -using namespace winrt; -using namespace Windows::Foundation; - -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { // Convert a WinRT IInspectable into a folly::dynamic object -folly::dynamic ConvertToDynamic(IInspectable const &object); +folly::dynamic ConvertToDynamic(Windows::Foundation::IInspectable const &object); -IInspectable ConvertToIInspectable(folly::dynamic const &object); +Windows::Foundation::IInspectable ConvertToIInspectable(folly::dynamic const &object); -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/ViewManagersProvider.cpp b/vnext/Microsoft.ReactNative/ViewManagersProvider.cpp index 2497f506516..06467b4ee0f 100644 --- a/vnext/Microsoft.ReactNative/ViewManagersProvider.cpp +++ b/vnext/Microsoft.ReactNative/ViewManagersProvider.cpp @@ -8,7 +8,8 @@ #include "ABIViewManager.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { + /*------------------------------------------------------------------------------- ViewManagersProvider::GetViewManagers -------------------------------------------------------------------------------*/ @@ -36,4 +37,4 @@ void ViewManagersProvider::AddViewManagerProvider( m_viewManagerProviders.emplace(to_string(viewManagerName), viewManagerProvider); } -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/ViewManagersProvider.h b/vnext/Microsoft.ReactNative/ViewManagersProvider.h index b73fc6be146..ba15ddc5988 100644 --- a/vnext/Microsoft.ReactNative/ViewManagersProvider.h +++ b/vnext/Microsoft.ReactNative/ViewManagersProvider.h @@ -7,12 +7,12 @@ #include #include -#include #include #include "ReactSupport.h" -namespace winrt::Microsoft::ReactNative::Bridge { +namespace winrt::Microsoft::ReactNative { + class ViewManagersProvider final : public react::uwp::ViewManagerProvider { public: virtual std::vector GetViewManagers( @@ -25,6 +25,6 @@ class ViewManagersProvider final : public react::uwp::ViewManagerProvider { ReactViewManagerProvider const &viewManagerProvider) noexcept; private: - std::unordered_map m_viewManagerProviders; + std::unordered_map m_viewManagerProviders; }; -} // namespace winrt::Microsoft::ReactNative::Bridge +} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/docs/NativeModules.md b/vnext/docs/NativeModules.md index e6e721666f3..3d81132b1fe 100644 --- a/vnext/docs/NativeModules.md +++ b/vnext/docs/NativeModules.md @@ -302,7 +302,7 @@ namespace NativeModuleSample { [webhosthidden] [default_interface] - runtimeclass ReactPackageProvider : Microsoft.ReactNative.Bridge.IReactPackageProvider + runtimeclass ReactPackageProvider : Microsoft.ReactNative.IReactPackageProvider { ReactPackageProvider(); }; @@ -317,7 +317,7 @@ After that we add the .h and.cpp files: #include "ReactPackageProvider.g.h" -using namespace winrt::Microsoft::ReactNative::Bridge; +using namespace winrt::Microsoft::ReactNative; namespace winrt::NativeModuleSample::implementation { @@ -346,8 +346,7 @@ namespace winrt::NativeModuleSample::factory_implementation // order for the AddAttributedModules call below to find them. #include "FancyMath.h" -using namespace winrt::Microsoft::ReactNative::Bridge; -using namespace Microsoft::ReactNative; +using namespace winrt::Microsoft::ReactNative; namespace winrt::NativeModuleSample::implementation { diff --git a/vnext/docs/ViewManagers.md b/vnext/docs/ViewManagers.md index 3ef5bf420d4..1337a005114 100644 --- a/vnext/docs/ViewManagers.md +++ b/vnext/docs/ViewManagers.md @@ -283,15 +283,15 @@ Here is a sample view manager written in C++ called `CustomUserControlViewManage ```c++ #pragma once -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" namespace winrt::ViewManagerSample::implementation { struct CustomUserControlViewManager : winrt::implements< CustomUserControlViewManager, - winrt::Microsoft::ReactNative::Bridge::IViewManager, - winrt::Microsoft::ReactNative::Bridge::IViewManagerWithNativeProperties, - winrt::Microsoft::ReactNative::Bridge::IViewManagerWithCommands> { + winrt::Microsoft::ReactNative::IViewManager, + winrt::Microsoft::ReactNative::IViewManagerWithNativeProperties, + winrt::Microsoft::ReactNative::IViewManagerWithCommands> { public: CustomUserControlViewManager() = default; @@ -302,7 +302,7 @@ struct CustomUserControlViewManager : winrt::implements< // IViewManagerWithNativeProperties winrt::Windows::Foundation::Collections:: - IMapView + IMapView NativeProps() noexcept; void UpdateProperties( @@ -328,7 +328,7 @@ struct CustomUserControlViewManager : winrt::implements< #include "CustomUserControlViewManager.h" using namespace winrt; -using namespace Microsoft::ReactNative::Bridge; +using namespace Microsoft::ReactNative; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/ReactPackageProvider.cpp b/vnext/local-cli/generator-windows/templates/cpp/src/ReactPackageProvider.cpp index 3bb3696d39d..2629da2362e 100644 --- a/vnext/local-cli/generator-windows/templates/cpp/src/ReactPackageProvider.cpp +++ b/vnext/local-cli/generator-windows/templates/cpp/src/ReactPackageProvider.cpp @@ -5,7 +5,7 @@ // clang-format off -using namespace winrt::Microsoft::ReactNative::Bridge; +using namespace winrt::Microsoft::ReactNative; namespace winrt::<%=ns%>::implementation { diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/ReactPackageProvider.h b/vnext/local-cli/generator-windows/templates/cpp/src/ReactPackageProvider.h index 005aa9735a1..c80555ba97a 100644 --- a/vnext/local-cli/generator-windows/templates/cpp/src/ReactPackageProvider.h +++ b/vnext/local-cli/generator-windows/templates/cpp/src/ReactPackageProvider.h @@ -1,10 +1,10 @@ #pragma once -#include "winrt/Microsoft.ReactNative.Bridge.h" +#include "winrt/Microsoft.ReactNative.h" // clang-format off -using namespace winrt::Microsoft::ReactNative::Bridge; +using namespace winrt::Microsoft::ReactNative; namespace winrt::<%=ns%>::implementation { diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/pch.h b/vnext/local-cli/generator-windows/templates/cpp/src/pch.h index e5b55575b32..7d322f9cdde 100644 --- a/vnext/local-cli/generator-windows/templates/cpp/src/pch.h +++ b/vnext/local-cli/generator-windows/templates/cpp/src/pch.h @@ -15,7 +15,6 @@ #include #include -#include #include #include