Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions change/react-native-windows-2020-04-25-00-45-24-wuxmux.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "prerelease",
"comment": "Start forking namespace and includes for WUX->MUX move",
"packageName": "react-native-windows",
"email": "asklar@microsoft.com",
"dependentChangeType": "patch",
"date": "2020-04-25T07:45:23.932Z"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
#include "future/future.h"

#include <functional>
#include "../include/CppWinRTIncludes.h"
#include "JSValue.h"

#undef GetCurrentTime
#include "Windows.UI.Xaml.h"

using namespace winrt;
using namespace Windows::UI::Xaml;

namespace winrt::Microsoft::ReactNative {

Expand Down Expand Up @@ -122,7 +121,7 @@ struct ReactContextMock : implements<ReactContextMock, IReactContext> {
ReactContextMock(ReactModuleBuilderMock *builderMock) noexcept;

void DispatchEvent(
FrameworkElement const & /*view*/,
xaml::FrameworkElement const & /*view*/,
hstring const & /*eventName*/,
JSValueArgWriter const & /*eventDataArgWriter*/) noexcept {}

Expand Down
4 changes: 2 additions & 2 deletions vnext/Microsoft.ReactNative.Cxx/JSValueXaml.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
#pragma once
#ifndef MICROSOFT_REACTNATIVE_JSVALUEXAML
#define MICROSOFT_REACTNATIVE_JSVALUEXAML

#include "../include/CppWinRTIncludes.h"
#include "JSValue.h"

namespace winrt::Microsoft::ReactNative {

#ifndef CXXUNITTESTS

inline void ReadValue(JSValue const &jsValue, Windows::UI::Xaml::Media::Brush &value) noexcept {
inline void ReadValue(JSValue const &jsValue, xaml::Media::Brush &value) noexcept {
value = XamlHelper::BrushFrom([&jsValue](IJSValueWriter const &writer) noexcept { jsValue.WriteTo(writer); });
}

Expand Down
31 changes: 14 additions & 17 deletions vnext/Microsoft.ReactNative/ABIViewManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const char *ABIViewManager::GetName() const {
return m_name.c_str();
}

winrt::Windows::UI::Xaml::DependencyObject ABIViewManager::CreateViewCore(int64_t) {
xaml::DependencyObject ABIViewManager::CreateViewCore(int64_t) {
auto view = m_viewManager.CreateView();
return view;
}
Expand Down Expand Up @@ -102,7 +102,7 @@ folly::dynamic ABIViewManager::GetNativeProps() const {

void ABIViewManager::UpdateProperties(react::uwp::ShadowNodeBase *nodeToUpdate, const folly::dynamic &reactDiffMap) {
if (m_viewManagerWithNativeProperties) {
auto view = nodeToUpdate->GetView().as<winrt::FrameworkElement>();
auto view = nodeToUpdate->GetView().as<xaml::FrameworkElement>();

IJSValueReader propertyMapReader = winrt::make<DynamicReader>(reactDiffMap);

Expand Down Expand Up @@ -132,11 +132,11 @@ folly::dynamic ABIViewManager::GetCommands() const {
}

void ABIViewManager::DispatchCommand(
const winrt::Windows::UI::Xaml::DependencyObject &viewToUpdate,
const xaml::DependencyObject &viewToUpdate,
const std::string &commandId,
const folly::dynamic &commandArgs) {
if (m_viewManagerWithCommands) {
auto view = viewToUpdate.as<winrt::FrameworkElement>();
auto view = viewToUpdate.as<xaml::FrameworkElement>();

IJSValueReader argReader = winrt::make<DynamicReader>(commandArgs);
m_viewManagerWithCommands.DispatchCommand(view, to_hstring(commandId), argReader);
Expand Down Expand Up @@ -186,40 +186,37 @@ folly::dynamic ABIViewManager::GetExportedCustomDirectEventTypeConstants() const
return parent;
}

void ABIViewManager::AddView(
const winrt::Windows::UI::Xaml::DependencyObject &parent,
const winrt::Windows::UI::Xaml::DependencyObject &child,
int64_t index) {
void ABIViewManager::AddView(const xaml::DependencyObject &parent, const xaml::DependencyObject &child, int64_t index) {
if (m_viewManagerWithChildren) {
m_viewManagerWithChildren.AddView(parent.as<winrt::FrameworkElement>(), child.as<winrt::UIElement>(), index);
m_viewManagerWithChildren.AddView(parent.as<xaml::FrameworkElement>(), child.as<xaml::UIElement>(), index);
} else {
Super::AddView(parent, child, index);
}
}

void ABIViewManager::RemoveAllChildren(const winrt::Windows::UI::Xaml::DependencyObject &parent) {
void ABIViewManager::RemoveAllChildren(const xaml::DependencyObject &parent) {
if (m_viewManagerWithChildren) {
m_viewManagerWithChildren.RemoveAllChildren(parent.as<winrt::FrameworkElement>());
m_viewManagerWithChildren.RemoveAllChildren(parent.as<xaml::FrameworkElement>());
} else {
Super::RemoveAllChildren(parent);
}
}

void ABIViewManager::RemoveChildAt(const winrt::Windows::UI::Xaml::DependencyObject &parent, int64_t index) {
void ABIViewManager::RemoveChildAt(const xaml::DependencyObject &parent, int64_t index) {
if (m_viewManagerWithChildren) {
m_viewManagerWithChildren.RemoveChildAt(parent.as<winrt::FrameworkElement>(), index);
m_viewManagerWithChildren.RemoveChildAt(parent.as<xaml::FrameworkElement>(), index);
} else {
Super::RemoveChildAt(parent, index);
}
}

void ABIViewManager::ReplaceChild(
const winrt::Windows::UI::Xaml::DependencyObject &parent,
const winrt::Windows::UI::Xaml::DependencyObject &oldChild,
const winrt::Windows::UI::Xaml::DependencyObject &newChild) {
const xaml::DependencyObject &parent,
const xaml::DependencyObject &oldChild,
const xaml::DependencyObject &newChild) {
if (m_viewManagerWithChildren) {
m_viewManagerWithChildren.ReplaceChild(
parent.as<winrt::FrameworkElement>(), oldChild.as<winrt::UIElement>(), newChild.as<winrt::UIElement>());
parent.as<xaml::FrameworkElement>(), oldChild.as<xaml::UIElement>(), newChild.as<xaml::UIElement>());
} else {
Super::ReplaceChild(parent, oldChild, newChild);
}
Expand Down
19 changes: 8 additions & 11 deletions vnext/Microsoft.ReactNative/ABIViewManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,24 @@ class ABIViewManager : public react::uwp::FrameworkElementViewManager {
folly::dynamic GetCommands() const override;

void DispatchCommand(
const winrt::Windows::UI::Xaml::DependencyObject &viewToUpdate,
const xaml::DependencyObject &viewToUpdate,
const std::string &commandId,
const folly::dynamic &commandArgs) override;

folly::dynamic GetExportedCustomBubblingEventTypeConstants() const override;

folly::dynamic GetExportedCustomDirectEventTypeConstants() const override;

void AddView(
const winrt::Windows::UI::Xaml::DependencyObject &parent,
const winrt::Windows::UI::Xaml::DependencyObject &child,
int64_t index) override;
void RemoveAllChildren(const winrt::Windows::UI::Xaml::DependencyObject &parent) override;
void RemoveChildAt(const winrt::Windows::UI::Xaml::DependencyObject &parent, int64_t index) override;
void AddView(const xaml::DependencyObject &parent, const xaml::DependencyObject &child, int64_t index) override;
void RemoveAllChildren(const xaml::DependencyObject &parent) override;
void RemoveChildAt(const xaml::DependencyObject &parent, int64_t index) override;
void ReplaceChild(
const winrt::Windows::UI::Xaml::DependencyObject &parent,
const winrt::Windows::UI::Xaml::DependencyObject &oldChild,
const winrt::Windows::UI::Xaml::DependencyObject &newChild) override;
const xaml::DependencyObject &parent,
const xaml::DependencyObject &oldChild,
const xaml::DependencyObject &newChild) override;

protected:
winrt::Windows::UI::Xaml::DependencyObject CreateViewCore(int64_t) override;
xaml::DependencyObject CreateViewCore(int64_t) override;

std::string m_name;
ReactNative::IViewManager m_viewManager;
Expand Down
2 changes: 1 addition & 1 deletion vnext/Microsoft.ReactNative/IReactContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace winrt::Microsoft::ReactNative {
ReactContext::ReactContext(Mso::CntPtr<Mso::React::IReactContext> &&context) noexcept : m_context{std::move(context)} {}

void ReactContext::DispatchEvent(
winrt::Windows::UI::Xaml::FrameworkElement const &view,
xaml::FrameworkElement const &view,
hstring const &eventName,
JSValueArgWriter const &eventDataArgWriter) noexcept {
folly::dynamic eventData; // default to NULLT
Expand Down
2 changes: 1 addition & 1 deletion vnext/Microsoft.ReactNative/IReactContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct ReactContext : winrt::implements<ReactContext, IReactContext> {

public: // IReactContext
void DispatchEvent(
winrt::Windows::UI::Xaml::FrameworkElement const &view,
xaml::FrameworkElement const &view,
hstring const &eventName,
JSValueArgWriter const &eventDataArgWriter) noexcept;
void CallJSFunction(
Expand Down
4 changes: 3 additions & 1 deletion vnext/Microsoft.ReactNative/IReactContext.idl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

import "IJSValueWriter.idl";

#include "../Include/NamespaceRedirect.h"

namespace Microsoft.ReactNative {

[webhosthidden]
interface IReactContext {
void DispatchEvent(Windows.UI.Xaml.FrameworkElement view, String eventName, JSValueArgWriter eventDataArgWriter);
void DispatchEvent(XAML_NAMESPACE.FrameworkElement view, String eventName, JSValueArgWriter eventDataArgWriter);
void CallJSFunction(String moduleName, String methodName, JSValueArgWriter paramsArgWriter);
void EmitJSEvent(String eventEmitterName, String eventName, JSValueArgWriter paramsArgWriter);
}
Expand Down
16 changes: 9 additions & 7 deletions vnext/Microsoft.ReactNative/IViewManager.idl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import "IReactModuleBuilder.idl";
import "IReactContext.idl";

#include "../Include/NamespaceRedirect.h"

namespace Microsoft.ReactNative
{
[webhosthidden]
Expand All @@ -22,7 +24,7 @@ namespace Microsoft.ReactNative
{
String Name { get; };

Windows.UI.Xaml.FrameworkElement CreateView();
XAML_NAMESPACE.FrameworkElement CreateView();
}

[webhosthidden]
Expand All @@ -42,15 +44,15 @@ namespace Microsoft.ReactNative
{
IMapView<String, ViewManagerPropertyType> NativeProps { get; };

void UpdateProperties(Windows.UI.Xaml.FrameworkElement view, IJSValueReader propertyMapReader);
void UpdateProperties(XAML_NAMESPACE.FrameworkElement view, IJSValueReader propertyMapReader);
}

[webhosthidden]
interface IViewManagerWithCommands
{
IVectorView<String> Commands { get; };

void DispatchCommand(Windows.UI.Xaml.FrameworkElement view, String commandId, IJSValueReader commandArgsReader);
void DispatchCommand(XAML_NAMESPACE.FrameworkElement view, String commandId, IJSValueReader commandArgsReader);
}

[webhosthidden]
Expand All @@ -64,12 +66,12 @@ namespace Microsoft.ReactNative
[webhosthidden]
interface IViewManagerWithChildren
{
void AddView(Windows.UI.Xaml.FrameworkElement parent, Windows.UI.Xaml.UIElement child, Int64 index);
void AddView(XAML_NAMESPACE.FrameworkElement parent, XAML_NAMESPACE.UIElement child, Int64 index);

void RemoveAllChildren(Windows.UI.Xaml.FrameworkElement parent);
void RemoveAllChildren(XAML_NAMESPACE.FrameworkElement parent);

void RemoveChildAt(Windows.UI.Xaml.FrameworkElement parent, Int64 index);
void RemoveChildAt(XAML_NAMESPACE.FrameworkElement parent, Int64 index);

void ReplaceChild(Windows.UI.Xaml.FrameworkElement parent, Windows.UI.Xaml.UIElement oldChild, Windows.UI.Xaml.UIElement newChild);
void ReplaceChild(XAML_NAMESPACE.FrameworkElement parent, XAML_NAMESPACE.UIElement oldChild, XAML_NAMESPACE.UIElement newChild);
}
} // namespace Microsoft.ReactNative
2 changes: 1 addition & 1 deletion vnext/Microsoft.ReactNative/Modules/AppStateData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using namespace winrt;
using namespace Windows::Foundation;
using namespace Windows::ApplicationModel;
using namespace Windows::UI::Xaml;
using namespace xaml;

namespace react::uwp {

Expand Down
5 changes: 2 additions & 3 deletions vnext/Microsoft.ReactNative/Modules/AppStateData.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <Modules/AppStateModule.h>
#include <winrt/Windows.ApplicationModel.h>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.UI.Xaml.h>
#include "ReactHost/React.h"
#include "activeObject/activeObject.h"

Expand All @@ -30,8 +29,8 @@ struct AppStateData : Mso::ActiveObject<> {
std::mutex m_stateMutex;
char const *m_lastState{nullptr};
Mso::CntPtr<Mso::React::IReactContext> m_reactContext;
winrt::Windows::UI::Xaml::Application::EnteredBackground_revoker m_enteredBackgroundRevoker;
winrt::Windows::UI::Xaml::Application::LeavingBackground_revoker m_leavingBackgroundRevoker;
xaml::Application::EnteredBackground_revoker m_enteredBackgroundRevoker;
xaml::Application::LeavingBackground_revoker m_leavingBackgroundRevoker;
};

// It is a temporary class that we need to keep until we remove ReactUWP
Expand Down
7 changes: 3 additions & 4 deletions vnext/Microsoft.ReactNative/ReactApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@

#include <winrt/Windows.ApplicationModel.Activation.h>
#include <winrt/Windows.UI.Core.h>
#include <winrt/Windows.UI.Xaml.Navigation.h>

using namespace winrt;
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;
using namespace Windows::UI::Xaml::Navigation;
using namespace xaml;
using namespace xaml::Controls;
using namespace xaml::Navigation;

namespace winrt::Microsoft::ReactNative::implementation {

Expand Down
2 changes: 1 addition & 1 deletion vnext/Microsoft.ReactNative/ReactApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct ReactApplication : ReactApplicationT<ReactApplication> {
void OnActivated(Windows::ApplicationModel::Activation::IActivatedEventArgs const &e);
void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const &e);
void OnSuspending(IInspectable const &, Windows::ApplicationModel::SuspendingEventArgs const &);
void OnNavigationFailed(IInspectable const &, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs const &);
void OnNavigationFailed(IInspectable const &, xaml::Navigation::NavigationFailedEventArgs const &);

protected:
virtual ReactApplicationDelegate __stdcall CreateReactApplicationDelegate();
Expand Down
3 changes: 2 additions & 1 deletion vnext/Microsoft.ReactNative/ReactApplication.idl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
// Licensed under the MIT License.

import "ReactNativeHost.idl";
#include "../include/NamespaceRedirect.h"

namespace Microsoft.ReactNative {

[webhosthidden]
[default_interface]
unsealed runtimeclass ReactApplication : Windows.UI.Xaml.Application {
unsealed runtimeclass ReactApplication : XAML_NAMESPACE.Application {
ReactApplication();

ReactInstanceSettings InstanceSettings { get; set; };
Expand Down
2 changes: 1 addition & 1 deletion vnext/Microsoft.ReactNative/ReactApplicationDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

using namespace winrt;
using namespace Windows::Foundation;
using namespace Windows::UI::Xaml;
using namespace xaml;
using namespace Windows::ApplicationModel;
using namespace Windows::ApplicationModel::Activation;

Expand Down
6 changes: 3 additions & 3 deletions vnext/Microsoft.ReactNative/ReactApplicationDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ namespace winrt::Microsoft::ReactNative::implementation {

struct ReactApplicationDelegate : ReactApplicationDelegateT<ReactApplicationDelegate> {
ReactApplicationDelegate() = default;
ReactApplicationDelegate(Windows::UI::Xaml::Application const &application) noexcept;
ReactApplicationDelegate(xaml::Application const &application) noexcept;

void OnActivated(Windows::ApplicationModel::Activation::IActivatedEventArgs const &args) noexcept;
Windows::UI::Xaml::UIElement OnCreate(hstring const &args) noexcept;
xaml::UIElement OnCreate(hstring const &args) noexcept;

private:
void OnResuming(IInspectable const &sender, IInspectable const &args) noexcept;
Expand All @@ -25,7 +25,7 @@ struct ReactApplicationDelegate : ReactApplicationDelegateT<ReactApplicationDele
Windows::ApplicationModel::EnteredBackgroundEventArgs const &args) noexcept;

private:
Windows::UI::Xaml::Application m_application{nullptr};
xaml::Application m_application{nullptr};
IReactApplication m_reactApplication{nullptr};
winrt::com_ptr<ReactRootView> m_reactRootView{nullptr};
};
Expand Down
5 changes: 3 additions & 2 deletions vnext/Microsoft.ReactNative/ReactApplicationDelegate.idl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
// Licensed under the MIT License.

import "ReactApplication.idl";
#include "../include/NamespaceRedirect.h"

namespace Microsoft.ReactNative {

[webhosthidden]
unsealed runtimeclass ReactApplicationDelegate {
ReactApplicationDelegate();
ReactApplicationDelegate(Windows.UI.Xaml.Application application);
ReactApplicationDelegate(XAML_NAMESPACE.Application application);
void OnActivated(Windows.ApplicationModel.Activation.IActivatedEventArgs args);
Windows.UI.Xaml.UIElement OnCreate(String args);
XAML_NAMESPACE.UIElement OnCreate(String args);
}
}
4 changes: 2 additions & 2 deletions vnext/Microsoft.ReactNative/ReactNativeHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

using namespace winrt;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace xaml;
using namespace xaml::Controls;

namespace winrt::Microsoft::ReactNative::implementation {

Expand Down
Loading