From 51368d02d2d0961411707c40901bf8d1bb20e1c4 Mon Sep 17 00:00:00 2001
From: Vladimir Morozov
Date: Mon, 27 Apr 2020 09:41:44 -0700
Subject: [PATCH 001/209] Added C# ReactContext for Module Initialize method
(#4722)
* Added C# ReactContext for Module Initialize method
* Change files
* Fixed sample project compilation
---
...020-04-26-21-09-42-MS_Cs_ReactContext.json | 8 +
.../windows/SampleLibraryCS/SampleModuleCS.cs | 2 +-
.../Microsoft.ReactNative.Cxx/NativeModules.h | 4 +
.../Microsoft.ReactNative.Cxx/ReactContext.h | 6 +
.../NativeModuleTest.cs | 2 +-
.../NoAttributeNativeModuleTest.cs | 19 +-
.../AttributedViewManager.cs | 5 +-
.../JSValueGenerator.cs | 67 +++----
...rosoft.ReactNative.SharedManaged.projitems | 2 +-
.../ReactConstantProvider.cs | 10 +-
.../ReactContext.cs | 176 ++++++++++++++++++
.../ReactContextExtensions.cs | 145 ---------------
.../ReactContextGenerator.cs | 17 +-
.../ReactEventInfo.cs | 6 +-
.../ReactFunctionInfo.cs | 6 +-
.../ReactInitializerInfo.cs | 7 +-
16 files changed, 258 insertions(+), 224 deletions(-)
create mode 100644 change/react-native-windows-2020-04-26-21-09-42-MS_Cs_ReactContext.json
create mode 100644 vnext/Microsoft.ReactNative.SharedManaged/ReactContext.cs
delete mode 100644 vnext/Microsoft.ReactNative.SharedManaged/ReactContextExtensions.cs
diff --git a/change/react-native-windows-2020-04-26-21-09-42-MS_Cs_ReactContext.json b/change/react-native-windows-2020-04-26-21-09-42-MS_Cs_ReactContext.json
new file mode 100644
index 00000000000..76cefbe6c3f
--- /dev/null
+++ b/change/react-native-windows-2020-04-26-21-09-42-MS_Cs_ReactContext.json
@@ -0,0 +1,8 @@
+{
+ "type": "prerelease",
+ "comment": "Added C# ReactContext for Module Initialize method",
+ "packageName": "react-native-windows",
+ "email": "vmorozov@microsoft.com",
+ "dependentChangeType": "patch",
+ "date": "2020-04-27T04:09:42.583Z"
+}
diff --git a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/SampleModuleCS.cs b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/SampleModuleCS.cs
index 44a7d049b27..cd40e29bd09 100644
--- a/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/SampleModuleCS.cs
+++ b/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/SampleModuleCS.cs
@@ -25,7 +25,7 @@ internal sealed class SampleModuleCS
#region Initializer
[ReactInitializer]
- public void Initialize(IReactContext _)
+ public void Initialize(ReactContext _)
{
_timer = ThreadPoolTimer.CreatePeriodicTimer(new TimerElapsedHandler((timer) =>
{
diff --git a/vnext/Microsoft.ReactNative.Cxx/NativeModules.h b/vnext/Microsoft.ReactNative.Cxx/NativeModules.h
index 65d82ca9ba2..d7ab009b8c5 100644
--- a/vnext/Microsoft.ReactNative.Cxx/NativeModules.h
+++ b/vnext/Microsoft.ReactNative.Cxx/NativeModules.h
@@ -694,6 +694,10 @@ struct ReactConstantProvider {
WriteProperty(m_writer, name, value);
}
+ IJSValueWriter const &Writer() const noexcept {
+ return m_writer;
+ }
+
private:
IJSValueWriter m_writer;
};
diff --git a/vnext/Microsoft.ReactNative.Cxx/ReactContext.h b/vnext/Microsoft.ReactNative.Cxx/ReactContext.h
index eee48e1569d..72dd33e5bda 100644
--- a/vnext/Microsoft.ReactNative.Cxx/ReactContext.h
+++ b/vnext/Microsoft.ReactNative.Cxx/ReactContext.h
@@ -17,6 +17,8 @@ namespace winrt::Microsoft::ReactNative {
struct ReactContext {
ReactContext(IReactContext const &context) noexcept;
+ IReactContext const &ContextAbi() const noexcept;
+
explicit operator bool() noexcept;
template
@@ -56,6 +58,10 @@ struct ReactContext {
inline ReactContext::ReactContext(IReactContext const &context) noexcept : m_context{context} {}
+inline IReactContext const &ReactContext::ContextAbi() const noexcept {
+ return m_context;
+}
+
inline ReactContext::operator bool() noexcept {
return m_context != nullptr;
}
diff --git a/vnext/Microsoft.ReactNative.Managed.UnitTests/NativeModuleTest.cs b/vnext/Microsoft.ReactNative.Managed.UnitTests/NativeModuleTest.cs
index 98f48a7127d..06ab0e8a6db 100644
--- a/vnext/Microsoft.ReactNative.Managed.UnitTests/NativeModuleTest.cs
+++ b/vnext/Microsoft.ReactNative.Managed.UnitTests/NativeModuleTest.cs
@@ -20,7 +20,7 @@ public struct Point
class SimpleNativeModule
{
[ReactInitializer]
- public void Initialize(IReactContext context)
+ public void Initialize(ReactContext context)
{
IsInitialized = true;
Assert.IsNotNull(context);
diff --git a/vnext/Microsoft.ReactNative.Managed.UnitTests/NoAttributeNativeModuleTest.cs b/vnext/Microsoft.ReactNative.Managed.UnitTests/NoAttributeNativeModuleTest.cs
index 43ccc114a80..f1863b1fd59 100644
--- a/vnext/Microsoft.ReactNative.Managed.UnitTests/NoAttributeNativeModuleTest.cs
+++ b/vnext/Microsoft.ReactNative.Managed.UnitTests/NoAttributeNativeModuleTest.cs
@@ -687,43 +687,48 @@ public void AddConstantProvider(Func> get
public void AddJSEvent(string eventEmitterName, string name, Action setEventHandler)
{
m_moduleBuilder.AddInitializer(reactContext => {
- setEventHandler(m_module, () => reactContext.EmitJSEvent(eventEmitterName ?? EventEmitterName ?? "RCTDeviceEventEmitter", name));
+ setEventHandler(m_module, () => new ReactContext(reactContext).EmitJSEvent(
+ eventEmitterName ?? EventEmitterName ?? "RCTDeviceEventEmitter", name));
});
}
public void AddJSEvent(string eventEmitterName, string name, Action> setEventHandler)
{
m_moduleBuilder.AddInitializer(reactContext => {
- setEventHandler(m_module, (T1 arg1) => reactContext.EmitJSEvent(eventEmitterName ?? EventEmitterName ?? "RCTDeviceEventEmitter", name, arg1));
+ setEventHandler(m_module, (T1 arg1) => new ReactContext(reactContext).EmitJSEvent(
+ eventEmitterName ?? EventEmitterName ?? "RCTDeviceEventEmitter", name, arg1));
});
}
public void AddJSEvent(string eventEmitterName, string name, Action> setEventHandler)
{
m_moduleBuilder.AddInitializer(reactContext => {
- setEventHandler(m_module, (T1 arg1, T2 arg2) =>
- reactContext.EmitJSEvent(eventEmitterName ?? EventEmitterName ?? "RCTDeviceEventEmitter", name, arg1, arg2));
+ setEventHandler(m_module, (T1 arg1, T2 arg2) => new ReactContext(reactContext).EmitJSEvent(
+ eventEmitterName ?? EventEmitterName ?? "RCTDeviceEventEmitter", name, arg1, arg2));
});
}
public void AddJSFunction(string moduleName, string name, Action setFunctionHandler)
{
m_moduleBuilder.AddInitializer(reactContext => {
- setFunctionHandler(m_module, () => reactContext.CallJSFunction(moduleName ?? ModuleName, name));
+ setFunctionHandler(m_module, () => new ReactContext(reactContext).CallJSFunction(
+ moduleName ?? ModuleName, name));
});
}
public void AddJSFunction(string moduleName, string name, Action> setFunctionHandler)
{
m_moduleBuilder.AddInitializer(reactContext => {
- setFunctionHandler(m_module, (T1 arg1) => reactContext.CallJSFunction(moduleName ?? ModuleName, name, arg1));
+ setFunctionHandler(m_module, (T1 arg1) => new ReactContext(reactContext).CallJSFunction(
+ moduleName ?? ModuleName, name, arg1));
});
}
public void AddJSFunction(string moduleName, string name, Action> setFunctionHandler)
{
m_moduleBuilder.AddInitializer(reactContext => {
- setFunctionHandler(m_module, (T1 arg1, T2 arg2) => reactContext.CallJSFunction(moduleName ?? ModuleName, name, arg1, arg2));
+ setFunctionHandler(m_module, (T1 arg1, T2 arg2) => new ReactContext(reactContext).CallJSFunction(
+ moduleName ?? ModuleName, name, arg1, arg2));
});
}
diff --git a/vnext/Microsoft.ReactNative.SharedManaged/AttributedViewManager.cs b/vnext/Microsoft.ReactNative.SharedManaged/AttributedViewManager.cs
index 56691b2be2f..ab835d574ae 100644
--- a/vnext/Microsoft.ReactNative.SharedManaged/AttributedViewManager.cs
+++ b/vnext/Microsoft.ReactNative.SharedManaged/AttributedViewManager.cs
@@ -402,8 +402,9 @@ private Delegate MakeEventDelegate(string eventName, Type memberType, Type event
ParameterExpression eventDataParameter = Expression.Parameter(eventDataType, "eventData");
MemberExpression thisReactContext = Expression.Property(Expression.Constant(this), "ReactContext");
- MethodCallExpression dispatchCall = Expression.Call(DispatchEventOf(eventDataType),
- thisReactContext,
+ NewExpression reactContext = Expression.New(ReactContextConstructor(), thisReactContext);
+ MethodCallExpression dispatchCall = Expression.Call(reactContext,
+ DispatchEventOf(eventDataType),
viewParameter,
Expression.Constant(eventName, typeof(string)),
eventDataParameter);
diff --git a/vnext/Microsoft.ReactNative.SharedManaged/JSValueGenerator.cs b/vnext/Microsoft.ReactNative.SharedManaged/JSValueGenerator.cs
index 13e1db92ca9..eaa35d5c61a 100644
--- a/vnext/Microsoft.ReactNative.SharedManaged/JSValueGenerator.cs
+++ b/vnext/Microsoft.ReactNative.SharedManaged/JSValueGenerator.cs
@@ -212,66 +212,41 @@ public Expression Assign(Expression value)
return Expression.Assign(AsExpression, value);
}
- public Expression Call(MethodInfo method, params Expression[] args)
+ // This method allows us to expand the argument array that may use parameters that are
+ // Expressions, VariableWrappers, or arrays of them.
+ // The argument expressions are added to the args list.
+ private void ExpandArgArray(IList args, object[] argObjects)
{
- return Expression.Call(AsExpression, method, args);
- }
-
- public Expression Call(string methodName, params Expression[] args)
- {
- return Call(Type.GetMethod(methodName), args);
- }
-
- public Expression CallExt(MethodInfo method)
- {
- return Expression.Call(method, AsExpression);
- }
-
- public Expression CallExt(MethodInfo method, Expression arg0)
- {
- return Expression.Call(method, AsExpression, arg0);
- }
-
- public Expression CallExt(MethodInfo method, Expression arg0, Expression arg1)
- {
- return Expression.Call(method, AsExpression, arg0, arg1);
- }
-
- public Expression CallExt(MethodInfo method, params Expression[] args)
- {
- return Expression.Call(method, Enumerable.Repeat(AsExpression, 1).Concat(args));
+ foreach (var arg in argObjects)
+ {
+ switch (arg)
+ {
+ case object[] items: ExpandArgArray(args, items); break;
+ case VariableWrapper variable: args.Add(variable.AsExpression); break;
+ case Expression expr: args.Add(expr); break;
+ }
+ }
}
- public Expression CallExt(MethodInfo method, params VariableWrapper[] args)
+ public MethodCallExpression Call(MethodInfo method, params object[] arguments)
{
- return Expression.Call(method,
- Enumerable.Repeat(this, 1).Concat(args).Select(v => v.AsExpression));
+ var args = new List();
+ ExpandArgArray(args, arguments);
+ return Expression.Call(AsExpression, method, args);
}
public MethodCallExpression CallExt(MethodInfo method, params object[] arguments)
{
var args = new List { AsExpression };
-
- void ParseArgs(object[] argObjects)
- {
- foreach (var arg in argObjects)
- {
- switch (arg)
- {
- case object[] items: ParseArgs(items); break;
- case VariableWrapper variable: args.Add(variable.AsExpression); break;
- case Expression expr: args.Add(expr); break;
- }
- }
- }
-
- ParseArgs(arguments);
+ ExpandArgArray(args, arguments);
return Expression.Call(method, args);
}
// It can be used only for delegate types
- public Expression Invoke(params Expression[] args)
+ public Expression Invoke(params object[] arguments)
{
+ var args = new List();
+ ExpandArgArray(args, arguments);
return Expression.Invoke(AsExpression, args);
}
diff --git a/vnext/Microsoft.ReactNative.SharedManaged/Microsoft.ReactNative.SharedManaged.projitems b/vnext/Microsoft.ReactNative.SharedManaged/Microsoft.ReactNative.SharedManaged.projitems
index 20a1c82159a..49a4f0ca31b 100644
--- a/vnext/Microsoft.ReactNative.SharedManaged/Microsoft.ReactNative.SharedManaged.projitems
+++ b/vnext/Microsoft.ReactNative.SharedManaged/Microsoft.ReactNative.SharedManaged.projitems
@@ -11,7 +11,7 @@
-
+
diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantProvider.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantProvider.cs
index 87e65ed1e54..2d6a048cb79 100644
--- a/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantProvider.cs
+++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactConstantProvider.cs
@@ -3,18 +3,18 @@
namespace Microsoft.ReactNative.Managed
{
- class ReactConstantProvider
+ struct ReactConstantProvider
{
public ReactConstantProvider(IJSValueWriter writer)
{
- m_writer = writer;
+ Writer = writer;
}
+ public IJSValueWriter Writer { get; }
+
public void Add(string constantName, T value)
{
- m_writer.WriteObjectProperty(constantName, value);
+ Writer.WriteObjectProperty(constantName, value);
}
-
- private readonly IJSValueWriter m_writer;
}
}
diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactContext.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactContext.cs
new file mode 100644
index 00000000000..bfd8098550f
--- /dev/null
+++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactContext.cs
@@ -0,0 +1,176 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using Windows.UI.Xaml;
+
+namespace Microsoft.ReactNative.Managed
+{
+ struct ReactContext
+ {
+ public ReactContext(IReactContext context)
+ {
+ ContextAbi = context;
+ }
+
+ public IReactContext ContextAbi { get; }
+
+ public void DispatchEvent(FrameworkElement view, string eventName, T arg)
+ {
+ var argWriter = arg as JSValueArgWriter;
+ if (argWriter != null)
+ {
+ ContextAbi.DispatchEvent(view, eventName, argWriter);
+ }
+ else
+ {
+ ContextAbi.DispatchEvent(view, eventName, (IJSValueWriter writer) => writer.WriteValue(arg));
+ }
+ }
+
+ public void CallJSFunction(string moduleName, string methodName)
+ {
+ ContextAbi.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs());
+ }
+
+ public void CallJSFunction(string moduleName, string methodName, T1 arg1)
+ {
+ var argWriter = arg1 as JSValueArgWriter;
+ if (argWriter != null)
+ {
+ ContextAbi.CallJSFunction(moduleName, methodName, argWriter);
+ }
+ else
+ {
+ ContextAbi.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1));
+ }
+ }
+
+ public void CallJSFunction(string moduleName, string methodName, T1 arg1, T2 arg2)
+ {
+ ContextAbi.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1, arg2));
+ }
+
+ public void CallJSFunction(string moduleName, string methodName, T1 arg1, T2 arg2, T3 arg3)
+ {
+ ContextAbi.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1, arg2, arg3));
+ }
+
+ public void CallJSFunction(
+ string moduleName, string methodName, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
+ {
+ ContextAbi.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1, arg2, arg3, arg4));
+ }
+
+ public void CallJSFunction(
+ string moduleName, string methodName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
+ {
+ ContextAbi.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1, arg2, arg3, arg4, arg5));
+ }
+
+ public void CallJSFunction(
+ string moduleName, string methodName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
+ {
+ ContextAbi.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1, arg2, arg3, arg4, arg5, arg6));
+ }
+
+ public void CallJSFunction(
+ string moduleName, string methodName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
+ {
+ ContextAbi.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1, arg2, arg3, arg4, arg5, arg6, arg7));
+ }
+
+ public void EmitJSEvent(string eventEmitterName, string eventName)
+ {
+ ContextAbi.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter _) => { });
+ }
+
+ public void EmitJSEvent(string eventEmitterName, string eventName, T1 arg1)
+ {
+ var argWriter = arg1 as JSValueArgWriter;
+ if (argWriter != null)
+ {
+ ContextAbi.EmitJSEvent(eventEmitterName, eventName, argWriter);
+ }
+ else
+ {
+ ContextAbi.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
+ {
+ writer.WriteValue(arg1);
+ });
+ }
+ }
+
+ public void EmitJSEvent(string eventEmitterName, string eventName, T1 arg1, T2 arg2)
+ {
+ ContextAbi.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
+ {
+ writer.WriteValue(arg1);
+ writer.WriteValue(arg2);
+ });
+ }
+
+ public void EmitJSEvent(string eventEmitterName, string eventName, T1 arg1, T2 arg2, T3 arg3)
+ {
+ ContextAbi.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
+ {
+ writer.WriteValue(arg1);
+ writer.WriteValue(arg2);
+ writer.WriteValue(arg3);
+ });
+ }
+
+ public void EmitJSEvent(
+ string eventEmitterName, string eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
+ {
+ ContextAbi.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
+ {
+ writer.WriteValue(arg1);
+ writer.WriteValue(arg2);
+ writer.WriteValue(arg3);
+ writer.WriteValue(arg4);
+ });
+ }
+
+ public void EmitJSEvent(
+ string eventEmitterName, string eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
+ {
+ ContextAbi.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
+ {
+ writer.WriteValue(arg1);
+ writer.WriteValue(arg2);
+ writer.WriteValue(arg3);
+ writer.WriteValue(arg4);
+ writer.WriteValue(arg5);
+ });
+ }
+
+ public void EmitJSEvent(
+ string eventEmitterName, string eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
+ {
+ ContextAbi.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
+ {
+ writer.WriteValue(arg1);
+ writer.WriteValue(arg2);
+ writer.WriteValue(arg3);
+ writer.WriteValue(arg4);
+ writer.WriteValue(arg5);
+ writer.WriteValue(arg6);
+ });
+ }
+
+ public void EmitJSEvent(
+ string eventEmitterName, string eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
+ {
+ ContextAbi.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
+ {
+ writer.WriteValue(arg1);
+ writer.WriteValue(arg2);
+ writer.WriteValue(arg3);
+ writer.WriteValue(arg4);
+ writer.WriteValue(arg5);
+ writer.WriteValue(arg6);
+ writer.WriteValue(arg7);
+ });
+ }
+ }
+}
diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactContextExtensions.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactContextExtensions.cs
deleted file mode 100644
index 9f1484be724..00000000000
--- a/vnext/Microsoft.ReactNative.SharedManaged/ReactContextExtensions.cs
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-using Windows.UI.Xaml;
-
-namespace Microsoft.ReactNative.Managed
-{
- static class ReactContextExtensions
- {
- public static void DispatchEvent(this IReactContext reactContext, FrameworkElement view, string eventName, T arg)
- {
- reactContext.DispatchEvent(view, eventName, (IJSValueWriter writer) => writer.WriteValue(arg));
- }
-
- public static void CallJSFunction(this IReactContext reactContext, string moduleName, string methodName)
- {
- reactContext.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs());
- }
-
- public static void CallJSFunction(this IReactContext reactContext, string moduleName, string methodName, T1 arg1)
- {
- reactContext.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1));
- }
-
- public static void CallJSFunction(this IReactContext reactContext, string moduleName, string methodName, T1 arg1, T2 arg2)
- {
- reactContext.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1, arg2));
- }
-
- public static void CallJSFunction(this IReactContext reactContext, string moduleName, string methodName, T1 arg1, T2 arg2, T3 arg3)
- {
- reactContext.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1, arg2, arg3));
- }
-
- public static void CallJSFunction(this IReactContext reactContext,
- string moduleName, string methodName, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
- {
- reactContext.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1, arg2, arg3, arg4));
- }
-
- public static void CallJSFunction(this IReactContext reactContext,
- string moduleName, string methodName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
- {
- reactContext.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1, arg2, arg3, arg4, arg5));
- }
-
- public static void CallJSFunction(this IReactContext reactContext,
- string moduleName, string methodName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
- {
- reactContext.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1, arg2, arg3, arg4, arg5, arg6));
- }
-
- public static void CallJSFunction(this IReactContext reactContext,
- string moduleName, string methodName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
- {
- reactContext.CallJSFunction(moduleName, methodName, (IJSValueWriter writer) => writer.WriteArgs(arg1, arg2, arg3, arg4, arg5, arg6, arg7));
- }
-
- public static void EmitJSEvent(this IReactContext reactContext, string eventEmitterName, string eventName)
- {
- reactContext.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) => {});
- }
-
- public static void EmitJSEvent(this IReactContext reactContext, string eventEmitterName, string eventName, T1 arg1)
- {
- reactContext.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
- {
- writer.WriteValue(arg1);
- });
- }
-
- public static void EmitJSEvent(this IReactContext reactContext, string eventEmitterName, string eventName, T1 arg1, T2 arg2)
- {
- reactContext.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
- {
- writer.WriteValue(arg1);
- writer.WriteValue(arg2);
- });
- }
-
- public static void EmitJSEvent(this IReactContext reactContext, string eventEmitterName, string eventName, T1 arg1, T2 arg2, T3 arg3)
- {
- reactContext.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
- {
- writer.WriteValue(arg1);
- writer.WriteValue(arg2);
- writer.WriteValue(arg3);
- });
- }
-
- public static void EmitJSEvent(this IReactContext reactContext,
- string eventEmitterName, string eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
- {
- reactContext.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
- {
- writer.WriteValue(arg1);
- writer.WriteValue(arg2);
- writer.WriteValue(arg3);
- writer.WriteValue(arg4);
- });
- }
-
- public static void EmitJSEvent(this IReactContext reactContext,
- string eventEmitterName, string eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
- {
- reactContext.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
- {
- writer.WriteValue(arg1);
- writer.WriteValue(arg2);
- writer.WriteValue(arg3);
- writer.WriteValue(arg4);
- writer.WriteValue(arg5);
- });
- }
-
- public static void EmitJSEvent(this IReactContext reactContext,
- string eventEmitterName, string eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
- {
- reactContext.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
- {
- writer.WriteValue(arg1);
- writer.WriteValue(arg2);
- writer.WriteValue(arg3);
- writer.WriteValue(arg4);
- writer.WriteValue(arg5);
- writer.WriteValue(arg6);
- });
- }
-
- public static void EmitJSEvent(this IReactContext reactContext,
- string eventEmitterName, string eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
- {
- reactContext.EmitJSEvent(eventEmitterName, eventName, (IJSValueWriter writer) =>
- {
- writer.WriteValue(arg1);
- writer.WriteValue(arg2);
- writer.WriteValue(arg3);
- writer.WriteValue(arg4);
- writer.WriteValue(arg5);
- writer.WriteValue(arg6);
- writer.WriteValue(arg7);
- });
- }
- }
-}
diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactContextGenerator.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactContextGenerator.cs
index e9f5fd6767e..f2a7f3a094b 100644
--- a/vnext/Microsoft.ReactNative.SharedManaged/ReactContextGenerator.cs
+++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactContextGenerator.cs
@@ -11,14 +11,13 @@ namespace Microsoft.ReactNative.Managed
{
static class ReactContextGenerator
{
- private static MethodInfo GetExtensionMethod(string methodName, Type[] typeArgs, params Type[] requiredArgTypes)
+ private static MethodInfo GetMethod(string methodName, Type[] typeArgs, params Type[] requiredArgTypes)
{
var extMethod =
- from member in typeof(ReactContextExtensions).GetMember(methodName, BindingFlags.Static | BindingFlags.Public)
+ from member in typeof(ReactContext).GetMember(methodName, BindingFlags.Instance | BindingFlags.Public)
let method = member as MethodInfo
let isGeneric = method.IsGenericMethod
where method != null
- && method.IsDefined(typeof(ExtensionAttribute), inherit: false)
let parameters = method.GetParameters()
where parameters.Length == typeArgs.Length + requiredArgTypes.Length
&& Enumerable.Range(0, requiredArgTypes.Length).All(i => parameters[i].ParameterType == requiredArgTypes[i])
@@ -26,22 +25,22 @@ from member in typeof(ReactContextExtensions).GetMember(methodName, BindingFlags
return extMethod.First();
}
+ public static ConstructorInfo ReactContextConstructor() =>
+ typeof(ReactContext).GetConstructor(new Type[] { typeof(IReactContext) });
+
public static MethodInfo DispatchEventOf(params Type[] typeArgs)
{
- return GetExtensionMethod(nameof(ReactContextExtensions.DispatchEvent), typeArgs,
- typeof(IReactContext), typeof(FrameworkElement), typeof(string));
+ return GetMethod(nameof(ReactContext.DispatchEvent), typeArgs, typeof(FrameworkElement), typeof(string));
}
public static MethodInfo CallJSFunctionOf(params Type[] typeArgs)
{
- return GetExtensionMethod(nameof(ReactContextExtensions.CallJSFunction), typeArgs,
- typeof(IReactContext), typeof(string), typeof(string));
+ return GetMethod(nameof(ReactContext.CallJSFunction), typeArgs, typeof(string), typeof(string));
}
public static MethodInfo EmitJSEventOf(params Type[] typeArgs)
{
- return GetExtensionMethod(nameof(ReactContextExtensions.EmitJSEvent), typeArgs,
- typeof(IReactContext), typeof(string), typeof(string));
+ return GetMethod(nameof(ReactContext.EmitJSEvent), typeArgs, typeof(string), typeof(string));
}
}
}
diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactEventInfo.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactEventInfo.cs
index f73f2a57c53..858fc886069 100644
--- a/vnext/Microsoft.ReactNative.SharedManaged/ReactEventInfo.cs
+++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactEventInfo.cs
@@ -65,7 +65,8 @@ private ReactEventImpl MakeEvent(PropertyInfo propertyInfo, string eventEmitterN
module.CastTo(propertyInfo.DeclaringType).SetProperty(propertyInfo,
AutoLambda(propertyInfo.PropertyType,
Parameters(eventArgTypes, out var args),
- reactContext.CallExt(EmitJSEventOf(eventArgTypes), Constant(eventEmitterName), Constant(eventName), args))));
+ New(ReactContextConstructor(), reactContext).Call(
+ EmitJSEventOf(eventArgTypes), Constant(eventEmitterName), Constant(eventName), args))));
}
private ReactEventImpl MakeEvent(FieldInfo fieldInfo, string eventEmitterName, string eventName, Type[] eventArgTypes)
@@ -84,7 +85,8 @@ private ReactEventImpl MakeEvent(FieldInfo fieldInfo, string eventEmitterName, s
module.CastTo(fieldInfo.DeclaringType).SetField(fieldInfo,
AutoLambda(fieldInfo.FieldType,
Parameters(eventArgTypes, out var args),
- reactContext.CallExt(EmitJSEventOf(eventArgTypes), Constant(eventEmitterName), Constant(eventName), args))));
+ New(ReactContextConstructor(), reactContext).Call(
+ EmitJSEventOf(eventArgTypes), Constant(eventEmitterName), Constant(eventName), args))));
}
public delegate void ReactEventImpl(object module, IReactContext reactContext);
diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactFunctionInfo.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactFunctionInfo.cs
index faf617e684b..777ef64f0bf 100644
--- a/vnext/Microsoft.ReactNative.SharedManaged/ReactFunctionInfo.cs
+++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactFunctionInfo.cs
@@ -65,7 +65,8 @@ private ReactFunctionImpl MakeFunction(PropertyInfo propertyInfo, string moduleN
module.CastTo(propertyInfo.DeclaringType).SetProperty(propertyInfo,
AutoLambda(propertyInfo.PropertyType,
Parameters(functionArgTypes, out var args),
- reactContext.CallExt(CallJSFunctionOf(functionArgTypes), Constant(moduleName), Constant(functionName), args))));
+ New(ReactContextConstructor(), reactContext).Call(
+ CallJSFunctionOf(functionArgTypes), Constant(moduleName), Constant(functionName), args))));
}
private ReactFunctionImpl MakeFunction(FieldInfo fieldInfo, string moduleName, string functionName, Type[] functionArgTypes)
@@ -84,7 +85,8 @@ private ReactFunctionImpl MakeFunction(FieldInfo fieldInfo, string moduleName, s
module.CastTo(fieldInfo.DeclaringType).SetField(fieldInfo,
AutoLambda(fieldInfo.FieldType,
Parameters(functionArgTypes, out var args),
- reactContext.CallExt(CallJSFunctionOf(functionArgTypes), Constant(moduleName), Constant(functionName), args))));
+ New(ReactContextConstructor(), reactContext).Call(
+ CallJSFunctionOf(functionArgTypes), Constant(moduleName), Constant(functionName), args))));
}
public delegate void ReactFunctionImpl(object module, IReactContext reactContext);
diff --git a/vnext/Microsoft.ReactNative.SharedManaged/ReactInitializerInfo.cs b/vnext/Microsoft.ReactNative.SharedManaged/ReactInitializerInfo.cs
index 7cb1a9aa062..9e8c23cd2c7 100644
--- a/vnext/Microsoft.ReactNative.SharedManaged/ReactInitializerInfo.cs
+++ b/vnext/Microsoft.ReactNative.SharedManaged/ReactInitializerInfo.cs
@@ -5,6 +5,7 @@
using System.Reflection;
using System.Threading;
using static Microsoft.ReactNative.Managed.JSValueGenerator;
+using static Microsoft.ReactNative.Managed.ReactContextGenerator;
using static System.Linq.Expressions.Expression;
namespace Microsoft.ReactNative.Managed
@@ -14,7 +15,7 @@ class ReactInitializerInfo
public ReactInitializerInfo(MethodInfo methodInfo)
{
ParameterInfo[] parameters = methodInfo.GetParameters();
- if (parameters.Length != 1 || parameters[0].ParameterType != typeof(IReactContext))
+ if (parameters.Length != 1 || parameters[0].ParameterType != typeof(ReactContext))
{
throw new ArgumentException($"Initializer method must have one parameter of IReactContext type."
+ $" Module: {methodInfo.DeclaringType.FullName} Method: {methodInfo.Name}");
@@ -29,13 +30,13 @@ private ReactInitializerImpl MakeInitializer(MethodInfo methodInfo)
//
// (object module, IReactContext reactContext) =>
// {
- // (module as MyModule).initializerMethod(reactContext);
+ // (module as MyModule).initializerMethod(new ReactContext(reactContext));
// });
return CompileLambda(
Parameter(typeof(object), out var module),
Parameter(typeof(IReactContext), out var reactContext),
- Call(module.CastTo(methodInfo.DeclaringType), methodInfo, reactContext));
+ Call(module.CastTo(methodInfo.DeclaringType), methodInfo, New(ReactContextConstructor(), reactContext)));
}
public delegate void ReactInitializerImpl(object module, IReactContext reactConext);
From fc72e04428dff1c31acdb9183f3ce95a0a5a53c1 Mon Sep 17 00:00:00 2001
From: Andrew Coates <30809111+acoates-ms@users.noreply.github.com>
Date: Mon, 27 Apr 2020 10:46:12 -0700
Subject: [PATCH 002/209] Update rex-win32 version to something more recent
(#4725)
* Update rex-win32 version to something more recent
* Change files
---
...-iss-react-native-win32-2020-04-27-09-42-09-uprex.json | 8 ++++++++
packages/react-native-win32/package.json | 2 +-
yarn.lock | 8 ++++----
3 files changed, 13 insertions(+), 5 deletions(-)
create mode 100644 change/@office-iss-react-native-win32-2020-04-27-09-42-09-uprex.json
diff --git a/change/@office-iss-react-native-win32-2020-04-27-09-42-09-uprex.json b/change/@office-iss-react-native-win32-2020-04-27-09-42-09-uprex.json
new file mode 100644
index 00000000000..6cb87e75fcd
--- /dev/null
+++ b/change/@office-iss-react-native-win32-2020-04-27-09-42-09-uprex.json
@@ -0,0 +1,8 @@
+{
+ "type": "none",
+ "comment": "Update rex-win32 version to something more recent",
+ "packageName": "@office-iss/react-native-win32",
+ "email": "acoates@microsoft.com",
+ "dependentChangeType": "none",
+ "date": "2020-04-27T16:42:09.664Z"
+}
diff --git a/packages/react-native-win32/package.json b/packages/react-native-win32/package.json
index 9f18e975354..275c1c1d759 100644
--- a/packages/react-native-win32/package.json
+++ b/packages/react-native-win32/package.json
@@ -43,7 +43,7 @@
"whatwg-fetch": "^3.0.0"
},
"devDependencies": {
- "@office-iss/rex-win32": "0.0.33",
+ "@office-iss/rex-win32": "0.0.0-devmain.12823.10000",
"@types/es6-collections": "^0.5.29",
"@types/es6-promise": "0.0.32",
"@types/node": "^12.11.2",
diff --git a/yarn.lock b/yarn.lock
index b910fbb87ac..0ad06fd74de 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2552,10 +2552,10 @@
universal-user-agent "^3.0.0"
url-template "^2.0.8"
-"@office-iss/rex-win32@0.0.33":
- version "0.0.33"
- resolved "https://registry.yarnpkg.com/@office-iss/rex-win32/-/rex-win32-0.0.33.tgz#960ed52275c827df58aede4819d39927bdf2ae70"
- integrity sha512-Eh4orZ3F4P03IJAn509H7rXPcA8/6iXIEJbBTrNdO0RK6gVIRQ/5GVVPg3BA3QrFN7GDJeXOqjN1/9daV4O8ag==
+"@office-iss/rex-win32@0.0.0-devmain.12823.10000":
+ version "0.0.0-devmain.12823.10000"
+ resolved "https://registry.yarnpkg.com/@office-iss/rex-win32/-/rex-win32-0.0.0-devmain.12823.10000.tgz#ad4e1cf040fc02e51fcc5f6ba926a3b6f2c14bb0"
+ integrity sha512-rAjjiSgUFcB0ogHSKklHF+CaDZd7OXCXrv0zkfDM4XY2xfJykOtnr6rT0OqRgZvInDT9RSxi0yuQ4ck1HV+Bdw==
dependencies:
command-line-args "^5.0.2"
command-line-usage "^5.0.5"
From 793ec2523ab10db23def810a2f41f68957766941 Mon Sep 17 00:00:00 2001
From: Andrew Coates <30809111+acoates-ms@users.noreply.github.com>
Date: Mon, 27 Apr 2020 10:46:37 -0700
Subject: [PATCH 003/209] Remove rnpm-plugin-windows pacakge (#4724)
* Remove rnpm-plugin-windows
* Change files
---
...react-native-windows--vnext--bug-report.md | 1 -
.github/workflows/pr.yml | 3 -
...e-windows-2020-04-27-09-14-14-delrnpm.json | 8 +
packages/E2ETest/package.json | 3 +-
.../package.json | 3 +-
packages/rnpm-plugin-windows/CHANGELOG.json | 187 -----------------
packages/rnpm-plugin-windows/CHANGELOG.md | 70 -------
packages/rnpm-plugin-windows/README.md | 52 -----
packages/rnpm-plugin-windows/index.js | 43 ----
packages/rnpm-plugin-windows/package.json | 33 ---
.../react-native.config.js | 5 -
packages/rnpm-plugin-windows/src/common.js | 196 ------------------
packages/rnpm-plugin-windows/src/windows.js | 96 ---------
packages/rnpm-plugin-windows/src/wpf.js | 42 ----
vnext/local-cli/runWindows/utils/info.js | 1 -
15 files changed, 10 insertions(+), 733 deletions(-)
create mode 100644 change/react-native-windows-2020-04-27-09-14-14-delrnpm.json
delete mode 100644 packages/rnpm-plugin-windows/CHANGELOG.json
delete mode 100644 packages/rnpm-plugin-windows/CHANGELOG.md
delete mode 100644 packages/rnpm-plugin-windows/README.md
delete mode 100644 packages/rnpm-plugin-windows/index.js
delete mode 100644 packages/rnpm-plugin-windows/package.json
delete mode 100644 packages/rnpm-plugin-windows/react-native.config.js
delete mode 100644 packages/rnpm-plugin-windows/src/common.js
delete mode 100644 packages/rnpm-plugin-windows/src/windows.js
delete mode 100644 packages/rnpm-plugin-windows/src/wpf.js
diff --git a/.github/ISSUE_TEMPLATE/react-native-windows--vnext--bug-report.md b/.github/ISSUE_TEMPLATE/react-native-windows--vnext--bug-report.md
index e04f2dbda25..6549797d05f 100644
--- a/.github/ISSUE_TEMPLATE/react-native-windows--vnext--bug-report.md
+++ b/.github/ISSUE_TEMPLATE/react-native-windows--vnext--bug-report.md
@@ -19,7 +19,6 @@ If you are using latest version:
Otherwise if `--info` doesn't exist:
1. `react-native -v`:
-2. `npm ls rnpm-plugin-windows`:
3. `npm ls react-native-windows`:
4. `node -v`:
5. `npm -v`:
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index e5a532a2b3e..6788ff5d38b 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -163,9 +163,6 @@ jobs:
- name: Init new project
run: cd ${{ runner.temp }} && react-native init testcli --version 0.60.6
- - name: Install rnpm-plugin-windows
- run: cd ${{ runner.temp }}\testcli && yarn add rnpm-plugin-windows@file:${{ runner.workspace }}\react-native-windows\current\local-cli\rnpm\windows
-
- name: Apply windows template
run: cd ${{ runner.temp }}\testcli && react-native windows --template vnext --windowsVersion file:${{ runner.workspace }}\react-native-windows\vnext
diff --git a/change/react-native-windows-2020-04-27-09-14-14-delrnpm.json b/change/react-native-windows-2020-04-27-09-14-14-delrnpm.json
new file mode 100644
index 00000000000..4b5933ed081
--- /dev/null
+++ b/change/react-native-windows-2020-04-27-09-14-14-delrnpm.json
@@ -0,0 +1,8 @@
+{
+ "type": "none",
+ "comment": "Remove rnpm-plugin-windows",
+ "packageName": "react-native-windows",
+ "email": "acoates@microsoft.com",
+ "dependentChangeType": "none",
+ "date": "2020-04-27T16:14:12.892Z"
+}
diff --git a/packages/E2ETest/package.json b/packages/E2ETest/package.json
index 46abc09dd84..4f080c7ea22 100644
--- a/packages/E2ETest/package.json
+++ b/packages/E2ETest/package.json
@@ -25,8 +25,7 @@
"prompt-sync": "^4.2.0",
"react": "16.9.0",
"react-native": "0.62.2",
- "react-native-windows": "0.0.0-master.50",
- "rnpm-plugin-windows": "^0.6.1"
+ "react-native-windows": "0.0.0-master.50"
},
"devDependencies": {
"@babel/core": "^7.8.4",
diff --git a/packages/microsoft-reactnative-sampleapps/package.json b/packages/microsoft-reactnative-sampleapps/package.json
index 85f228c1c27..7889e67990c 100644
--- a/packages/microsoft-reactnative-sampleapps/package.json
+++ b/packages/microsoft-reactnative-sampleapps/package.json
@@ -16,8 +16,7 @@
"dependencies": {
"react": "16.9.0",
"react-native": "0.62.2",
- "react-native-windows": "0.0.0-master.50",
- "rnpm-plugin-windows": "^0.6.1"
+ "react-native-windows": "0.0.0-master.50"
},
"devDependencies": {
"@babel/core": "^7.8.4",
diff --git a/packages/rnpm-plugin-windows/CHANGELOG.json b/packages/rnpm-plugin-windows/CHANGELOG.json
deleted file mode 100644
index 54132a5ce53..00000000000
--- a/packages/rnpm-plugin-windows/CHANGELOG.json
+++ /dev/null
@@ -1,187 +0,0 @@
-{
- "name": "rnpm-plugin-windows",
- "entries": [
- {
- "date": "Wed, 25 Mar 2020 20:04:59 GMT",
- "tag": "rnpm-plugin-windows_v0.6.1",
- "version": "0.6.1",
- "comments": {
- "patch": [
- {
- "comment": "allow CLI to install from file:",
- "author": "kmelmon@microsoft.com",
- "commit": "407c0834ada43cd9d42c24cb6ddfe7c91ddf960a"
- }
- ]
- }
- },
- {
- "date": "Tue, 24 Mar 2020 22:51:22 GMT",
- "tag": "rnpm-plugin-windows_v0.6.0",
- "version": "0.6.0",
- "comments": {
- "minor": [
- {
- "comment": "Teach React Native CLI about master and 0.61 versions",
- "author": "ngerlem@microsoft.com",
- "commit": "407c0834ada43cd9d42c24cb6ddfe7c91ddf960a"
- }
- ]
- }
- },
- {
- "date": "Thu, 27 Feb 2020 18:38:20 GMT",
- "tag": "rnpm-plugin-windows_v0.5.1-0",
- "version": "0.5.1-0",
- "comments": {
- "none": [
- {
- "comment": "Move rnpm-plugin-windows package out of current",
- "author": "acoates@microsoft.com",
- "commit": "2a2bf8556317d97b52c8339b038943b484864f77"
- }
- ]
- }
- },
- {
- "date": "Tue, 11 Feb 2020 01:21:44 GMT",
- "tag": "rnpm-plugin-windows_v0.5.1-0",
- "version": "0.5.1-0",
- "comments": {
- "prerelease": [
- {
- "comment": "Fix CLI dependency",
- "author": "acoates@microsoft.com",
- "commit": "33f9509e627c111fa5582e11c78d0b00a3b6ce05"
- }
- ]
- }
- },
- {
- "date": "Tue, 17 Dec 2019 23:33:28 GMT",
- "tag": "rnpm-plugin-windows_v0.4.0",
- "version": "0.4.0",
- "comments": {
- "minor": [
- {
- "comment": "add prompt to CLI",
- "author": "kmelmon@microsoft.com",
- "commit": "364e3cd867a026a9f57f0cb526be03bd5300a39d"
- }
- ]
- }
- },
- {
- "date": "Tue, 17 Dec 2019 21:45:01 GMT",
- "tag": "rnpm-plugin-windows_v0.3.9",
- "version": "0.3.9",
- "comments": {
- "patch": [
- {
- "comment": "CLI detect project name from app.json",
- "author": "licanhua@live.com",
- "commit": "ed24ef5033bac55fb8f0db6ee727051521e4682c"
- }
- ]
- }
- },
- {
- "date": "Wed, 06 Nov 2019 13:58:14 GMT",
- "tag": "rnpm-plugin-windows_v0.3.8",
- "version": "0.3.8",
- "comments": {
- "patch": [
- {
- "comment": "This change enables consuming JSI implementations where the referenced JSI headers differs from the JSI headers in react-native.",
- "author": "anandrag@microsoft.com",
- "commit": "04b58d679ba04baca23348928fad5250a34d31b9"
- }
- ]
- }
- },
- {
- "date": "Thu, 17 Oct 2019 20:58:22 GMT",
- "tag": "rnpm-plugin-windows_v0.3.7",
- "version": "0.3.7",
- "comments": {
- "patch": [
- {
- "comment": "Fix two issues: 1) you cannot animated 2 subchannels of the same property with different animations. to fix this we animated yet another property set for translation and scale owned by the props nodes and use one animation to animate all of the subchannels for the uiElement. 2) Reference parameter names which started with a multi digit number are unsupported so i added an n to the start of each name, which was previously just the node's tag.",
- "author": "stpete@microsoft.com",
- "commit": "62049fdbd667fc71ae09b09f074446d8593d826d"
- }
- ]
- }
- },
- {
- "date": "Tue, 15 Oct 2019 13:59:27 GMT",
- "tag": "rnpm-plugin-windows_v0.3.6",
- "version": "0.3.6",
- "comments": {
- "patch": [
- {
- "comment": "Updates logic for `wpf` command to install correct dependency",
- "author": "erozell@outlook.com",
- "commit": "2325263a2cd4bd66ae7f78f2fa01650aee280345"
- }
- ]
- }
- },
- {
- "date": "Thu, 03 Oct 2019 22:17:13 GMT",
- "tag": "rnpm-plugin-windows_v0.3.5",
- "version": "0.3.5",
- "comments": {
- "none": [
- {
- "comment": "Support contextMenuHidden",
- "author": "dida@ntdev.microsoft.com",
- "commit": "18b68810d1f1687889909782e47750afe6f06b24"
- }
- ]
- }
- },
- {
- "date": "Tue, 01 Oct 2019 18:17:42 GMT",
- "tag": "rnpm-plugin-windows_v0.3.5",
- "version": "0.3.5",
- "comments": {
- "patch": [
- {
- "comment": "The customer provided examples revealed a few of issues. One, we were dubble counding the starting value of animatiosn in some cases. Two we were incorrectly relying on JS to tell us to flatten our animated values. Three we were detaching the expression animations that tied the property to the UIElement and in certain cases the JS thread does not inform us that we need to rebuild this cuppling. There is an open issue with this final part #3280",
- "author": "stpete@microsoft.com",
- "commit": "87e54197b92a06e15acc0d3da7c4016eb3c95448"
- }
- ]
- }
- },
- {
- "date": "Sat, 28 Sep 2019 01:21:33 GMT",
- "tag": "rnpm-plugin-windows_v0.3.0",
- "version": "0.3.0",
- "comments": {
- "minor": [
- {
- "comment": "add support for cpp",
- "author": "email not defined",
- "commit": "10233b95839d33eb57d32eaa6b67462f643884c4"
- }
- ]
- }
- },
- {
- "date": "Tue, 24 Sep 2019 19:11:20 GMT",
- "tag": "rnpm-plugin-windows_v0.2.13",
- "version": "0.2.13",
- "comments": {
- "patch": [
- {
- "comment": "Support latest react-native-cli",
- "author": "acoates@microsoft.com",
- "commit": "704b5b46704d5638293c3f6ff0f3bd09e6bfa809"
- }
- ]
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/packages/rnpm-plugin-windows/CHANGELOG.md b/packages/rnpm-plugin-windows/CHANGELOG.md
deleted file mode 100644
index 3e9ac981f07..00000000000
--- a/packages/rnpm-plugin-windows/CHANGELOG.md
+++ /dev/null
@@ -1,70 +0,0 @@
-# Change Log - rnpm-plugin-windows
-
-This log was last generated on Wed, 25 Mar 2020 20:04:59 GMT and should not be manually modified.
-
-## 0.6.1
-Wed, 25 Mar 2020 20:04:59 GMT
-
-### Patches
-
-- allow CLI to install from file: (kmelmon@microsoft.com)
-## 0.6.0
-Tue, 24 Mar 2020 22:51:22 GMT
-
-### Minor changes
-
-- Teach React Native CLI about master and 0.61 versions (ngerlem@microsoft.com)
-## 0.5.1-0
-Tue, 11 Feb 2020 01:21:44 GMT
-
-### Changes
-
-- Fix CLI dependency (acoates@microsoft.com)
-## 0.4.0
-Tue, 17 Dec 2019 23:33:28 GMT
-
-### Minor changes
-
-- add prompt to CLI (kmelmon@microsoft.com)
-## 0.3.9
-Tue, 17 Dec 2019 21:45:01 GMT
-
-### Patches
-
-- CLI detect project name from app.json (licanhua@live.com)
-## 0.3.8
-Wed, 06 Nov 2019 13:58:14 GMT
-
-### Patches
-
-- This change enables consuming JSI implementations where the referenced JSI headers differs from the JSI headers in react-native. (anandrag@microsoft.com)
-## 0.3.7
-Thu, 17 Oct 2019 20:58:22 GMT
-
-### Patches
-
-- Fix two issues: 1) you cannot animated 2 subchannels of the same property with different animations. to fix this we animated yet another property set for translation and scale owned by the props nodes and use one animation to animate all of the subchannels for the uiElement. 2) Reference parameter names which started with a multi digit number are unsupported so i added an n to the start of each name, which was previously just the node's tag. (stpete@microsoft.com)
-## 0.3.6
-Tue, 15 Oct 2019 13:59:27 GMT
-
-### Patches
-
-- Updates logic for `wpf` command to install correct dependency (erozell@outlook.com)
-## 0.3.5
-Tue, 01 Oct 2019 18:17:42 GMT
-
-### Patches
-
-- The customer provided examples revealed a few of issues. One, we were dubble counding the starting value of animatiosn in some cases. Two we were incorrectly relying on JS to tell us to flatten our animated values. Three we were detaching the expression animations that tied the property to the UIElement and in certain cases the JS thread does not inform us that we need to rebuild this cuppling. There is an open issue with this final part #3280 (stpete@microsoft.com)
-## 0.3.0
-Sat, 28 Sep 2019 01:21:33 GMT
-
-### Minor changes
-
-- add support for cpp (email not defined)
-## 0.2.13
-Tue, 24 Sep 2019 19:11:20 GMT
-
-### Patches
-
-- Support latest react-native-cli (acoates@microsoft.com)
\ No newline at end of file
diff --git a/packages/rnpm-plugin-windows/README.md b/packages/rnpm-plugin-windows/README.md
deleted file mode 100644
index e55920a0a16..00000000000
--- a/packages/rnpm-plugin-windows/README.md
+++ /dev/null
@@ -1,52 +0,0 @@
-# RNPM Plugin for Universal Windows
-
-To bootstrap the creation of Windows projects for React Native, we've published `rnpm-plugin-windows`. The purpose of this plugin is to provide project init functionality comparable to `react-native init` and `react-native android`, and to allow users to build and run React Windows applications from the command line.
-
-## Project Initialization
-
-To start, make sure you have the react-native CLI installed globally.
-
-```
-npm install -g react-native-cli
-```
-
-Once the CLI is installed, install rnpm-plugin-windows and initialize your project. Note: if you have Yarn installed, the react-native-cli will prefer to use that instead of npm, so use yarn to install `rnpm-plugin-windows`.
-
-```
-npm install --save-dev rnpm-plugin-windows
-react-native windows
-```
-
-The `windows` command will do the following:
-- Install `react-native-windows` from [NPM](https://www.npmjs.com/package/react-native-windows)
-- Read the name of your project from `package.json`
-- Use [Yeoman](http://yeoman.io/) to generate the Windows project files.
-
-### Usage
-
-```
-react-native windows [name] [--namespace ] [--windowsVersion ]
-```
-
-The `windows` command takes an optional command line argument.
-- `name` - The name of the project, which will be used for both file names and the name of the component that is registered in the React Native [AppRegistry](https://facebook.github.io/react-native/docs/appregistry.html). Default value is the name given in the root-level `package.json`.
-
-The `windows` command accepts two optional flags.
-- `--namepace` - The namespace that will be used in the generated native C# code. Default value is `name`.
-- `--windowsVersion` - The version of `react-native-windows` that will be used. Default value is matches the major and minor version of `react-native` if installed, otherwise the latest version.
-
-### React Native 0.27.* -> 0.30.*
-
-For versions of react-native prior to 0.31.0, you'll need to use the [rnpm](http://github.com/rnpm/rnpm) global CLI to run the `windows` command. Since the RNPM plugin syntax for the react-native CLI is not backward compatibile with rnpm, you'll need to use an older version of `rnpm-plugin-windows`:
-
-```
-npm install --save-dev rnpm-plugin-windows@0.1.*
-```
-
-## Running React Windows Applications
-
-Once `react-native-windows` is installed in your project, an additional RNPM plugin for running Windows apps is exposed to the `react-native-cli`. To deploy your app to Desktop, execute:
-```
-react-native run-windows
-```
-For more information on the kinds of options and flags available for deploying to devices and emulators, use the `--help` flag to get the command usage information.
diff --git a/packages/rnpm-plugin-windows/index.js b/packages/rnpm-plugin-windows/index.js
deleted file mode 100644
index bdd2e8b364c..00000000000
--- a/packages/rnpm-plugin-windows/index.js
+++ /dev/null
@@ -1,43 +0,0 @@
-module.exports = [{
- func: require('./src/windows'),
- description: 'Generate React Native Windows template project',
- name: 'windows [name]',
- options: [{
- command: '--windowsVersion [version]',
- description: 'The version of react-native-windows to use.',
- }, {
- command: '--namespace [namespace]',
- description: 'The native project namespace.',
- }, {
- command: '--verbose',
- description: 'Enables logging.',
- default: false,
- }, {
- command: '--template [template]',
- description: 'Template to install. E.g., `vnext`.',
- }, {
- command: '--language [language]',
- description: 'Which language the template app is written in. Possible values are cs and cpp',
- default: 'cpp',
- }, {
- command: '--overwrite',
- description: 'Overwrite any existing files without prompting',
- default: false,
- }],
-},{
- func: require('./src/wpf'),
- description: 'Generate React Native Windows template project on WPF',
- name: 'wpf [name]',
- options: [{
- command: '--windowsVersion [version]',
- description: 'The version of react-native-wpf to use.',
- }, {
- command: '--namespace [namespace]',
- description: 'The native project namespace.',
- }, {
- command: '--verbose',
- description: 'Enables logging',
- default: false,
- }],
-},
-];
diff --git a/packages/rnpm-plugin-windows/package.json b/packages/rnpm-plugin-windows/package.json
deleted file mode 100644
index e1a1366e3c9..00000000000
--- a/packages/rnpm-plugin-windows/package.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "name": "rnpm-plugin-windows",
- "version": "0.6.1",
- "description": "rnpm plugin that generates a Windows template project",
- "main": "index.js",
- "keywords": [
- "rnpm",
- "react-native",
- "react-native-windows",
- "rnpm windows"
- ],
- "repository": {
- "type": "git",
- "url": "https://github.com/Microsoft/react-native-windows.git"
- },
- "engines": {
- "node": ">= 4.0.0"
- },
- "license": "MIT",
- "peerDependencies": {
- "react-native": ">=0.31.0"
- },
- "dependencies": {
- "chalk": "^1.1.3",
- "extract-zip": "^1.6.7",
- "fs-extra": "^7.0.1",
- "npm-registry": "^0.1.13",
- "prompts": "^2.3.0",
- "request": "^2.88.0",
- "semver": "^6.1.1",
- "valid-url": "^1.0.9"
- }
-}
diff --git a/packages/rnpm-plugin-windows/react-native.config.js b/packages/rnpm-plugin-windows/react-native.config.js
deleted file mode 100644
index 0ab8a95efe9..00000000000
--- a/packages/rnpm-plugin-windows/react-native.config.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// @ts-check
-
-module.exports = {
- commands: require('./index'),
-};
diff --git a/packages/rnpm-plugin-windows/src/common.js b/packages/rnpm-plugin-windows/src/common.js
deleted file mode 100644
index 653f6a25762..00000000000
--- a/packages/rnpm-plugin-windows/src/common.js
+++ /dev/null
@@ -1,196 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License.
- */
-'use strict';
-
-const fs = require('fs');
-const path = require('path');
-const semver = require('semver');
-const Registry = require('npm-registry');
-const child_process = require('child_process');
-const validUrl = require('valid-url');
-
-let npmConfReg = child_process.execSync('npm config get registry').toString().trim();
-let NPM_REGISTRY_URL = validUrl.is_uri(npmConfReg) ? npmConfReg : 'http://registry.npmjs.org';
-
-const REACT_NATIVE_PACKAGE_JSON_PATH = function() {
- return path.resolve(
- process.cwd(),
- 'node_modules',
- 'react-native',
- 'package.json'
- );
-};
-
-const npm = new Registry({registry: NPM_REGISTRY_URL});
-
-function getLatestVersion() {
- return new Promise(function (resolve, reject) {
- npm.packages.release('react-native-windows', 'latest', (err, releases) => {
- if (err) {
- reject(err);
- } else if (!releases || releases.length === 0) {
- reject(new Error('Could not find react-native-windows@latest.'));
- } else {
- resolve(releases[0].version);
- }
- });
- });
-}
-
-function isTagMatch(packageVersion, requestTag) {
- const prerelease = semver.prerelease(packageVersion);
- if (prerelease === null && !requestTag) {
- return true;
- } else {
- return prerelease && prerelease[0] === requestTag;
- }
-}
-
-function isVersionMatch(packageVersion, requestVersion, requestTag) {
- if (semver.parse(packageVersion) === null) {
- return false;
- }
-
- const { major, minor } = semver.parse(packageVersion);
- const minVersion = semver.minVersion(requestVersion);
- return major === minVersion.major &&
- minor === minVersion.minor &&
- isTagMatch(packageVersion, requestTag);
-}
-
-function getLatestMatchingVersion(versionRange, tag) {
- return new Promise((resolve, reject) => {
- // Ignore the version range of React Native if asking for master, since our
- // RNW version may not align.
- if (tag === 'master') {
- npm.packages.release('react-native-windows', 'master', (err, rel) => {
- if (err) {
- reject(err);
- } else {
- resolve(rel[0].version);
- }
- });
- } else {
- npm.packages.releases('react-native-windows', (err, rels) => {
- if (err) {
- reject(err);
- } else {
- const matchingVersions = Object.keys(rels)
- .filter(v => isVersionMatch(v, versionRange, tag))
- .sort(semver.rcompare);
-
- if (matchingVersions.length > 0) {
- resolve(matchingVersions[0]);
- } else {
- reject();
- }
- }
- });
- }
- });
-}
-
-/**
- * Matches a version range to a version of react-native-windows to install. This is a hairy process
- * with a few different cases. Note that we will not run this at all if an exact version was given
- * for --windowsVersion.
- *
- * - If no version was specified we are passed a range based on React Native version. E.g. "0.61.*".
- * We will try to match this against available packages, but need special rules for prerelease
- * tags since we use them for even stable releases for several versions. Because of that we cannot
- * use the semver range directly.
- *
- * - If our tag is "master", we grab the latest master label builds, since our RN version may not
- * correspond to our RNW version. This will change once we're aligned to Facebook's master builds.
- *
- * - Users can pass in a range to --windowsVersion and we will try to respect it according to above
- * matching logic. We likely do not do the right thing here in many cases sine we do not query the
- * registry for the range directly, instead using custom logic to also ensure tag matches.
- */
-async function getMatchingVersion(versionRange, tag) {
- const versionStr = tag === 'master' ? 'master' : versionRange;
- console.log(`Checking for react-native-windows version matching ${versionStr}...`);
-
- try {
- return await getLatestMatchingVersion(versionRange, tag);
- } catch (ex) {
- const latestVersion = await getLatestVersion();
- throw new Error(`Could not find react-native-windows@${versionStr}. ` +
- `Latest version of react-native-windows is ${latestVersion}, try switching to ` +
- `react-native@${semver.major(latestVersion)}.${semver.minor(latestVersion)}.*.`);
- }
-}
-
-const isSupportedVersion = function(validVersion, validRange) {
- // Allow 0.0.0-x master builds
- if (validVersion) {
- return semver.lt(validVersion, '0.0.0') || semver.gte(validVersion, '0.27.0');
- } else if (validRange) {
- return semver.gtr('0.0.0', validRange) || semver.ltr('0.27.0', validRange);
- } else {
- return false;
- }
-};
-
-const getInstallPackage = function (version, tag) {
- const packageToInstall = 'react-native-windows';
- const validVersion = semver.valid(version);
- const validRange = semver.validRange(version);
-
- if (!isSupportedVersion(validVersion, validRange)) {
- console.error(
- 'Please upgrade react-native to ^0.27 or specify a --windowsVersion that is >=0.27.0'
- );
- process.exit(1);
- }
-
- if (validVersion) {
- return Promise.resolve(`${packageToInstall}@${version}`);
- } else {
- return getMatchingVersion(version, tag)
- .then(resultVersion => `${packageToInstall}@${resultVersion}`);
- }
-};
-
-const getReactNativeVersion = function () {
- console.log('Reading react-native version from node_modules...');
- if (fs.existsSync(REACT_NATIVE_PACKAGE_JSON_PATH())) {
- const version = JSON.parse(fs.readFileSync(REACT_NATIVE_PACKAGE_JSON_PATH(), 'utf-8')).version;
- return `${semver.major(version)}.${semver.minor(version)}.*`;
- }
-};
-
-const getReactNativeAppName = function () {
- console.log('Reading application name from package.json...');
- let name = JSON.parse(fs.readFileSync('package.json', 'utf8')).name;
- if (!name) {
- if (fs.existsSync('app.json')) {
- console.log('Reading application name from app.json...');
- name = JSON.parse(fs.readFileSync('app.json', 'utf8')).name;
- }
- }
- if (!name) {
- console.error('Please specify name in package.json or app.json');
- }
- return name;
-};
-
-/**
- * Check that 'react-native init' itself used yarn to install React Native.
- * When using an old global react-native-cli@1.0.0 (or older), we don't want
- * to install React Native with npm, and React + Jest with yarn.
- * Let's be safe and not mix yarn and npm in a single project.
- * @param projectDir e.g. /Users/martin/AwesomeApp
- */
-const isGlobalCliUsingYarn = function(projectDir) {
- return fs.existsSync(path.join(projectDir, 'yarn.lock'));
-};
-
-module.exports = {
- getInstallPackage,
- getReactNativeVersion,
- getReactNativeAppName,
- isGlobalCliUsingYarn,
-};
diff --git a/packages/rnpm-plugin-windows/src/windows.js b/packages/rnpm-plugin-windows/src/windows.js
deleted file mode 100644
index 502ce3640de..00000000000
--- a/packages/rnpm-plugin-windows/src/windows.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License.
- */
-'use strict';
-
-const Common = require('./common');
-const chalk = require('chalk');
-const execSync = require('child_process').execSync;
-const path = require('path');
-const prompts = require('prompts');
-const semver = require('semver');
-
-const REACT_NATIVE_WINDOWS_GENERATE_PATH = function() {
- return path.resolve(
- process.cwd(),
- 'node_modules',
- 'react-native-windows',
- 'local-cli',
- 'generate-windows.js'
- );
-};
-
-async function getDefaultVersionTag(version) {
- const validVersion = semver.valid(version);
- const validRange = semver.validRange(version);
- if (!validVersion && !validRange) {
- console.error(chalk.red(`'${version}' is not a valid version`));
- process.exit(1);
- }
-
- // 0.57 and below had stable untagged releases
- if ((validVersion && semver.lt(validVersion, '0.58.0'))
- || (validRange && semver.gtr('0.58.0', validRange))) {
- return null;
- }
-
- // 0.58 went to RC (See #2559)
- if ((validVersion && semver.lt(validVersion, '0.59.0'))
- || (validRange && semver.gtr('0.59.0', validRange))) {
- return 'rc';
- }
-
- // 0.59 tags releases as "legacy" or "vnext"
- if ((validVersion && semver.lt(validVersion, '0.60.0'))
- || (validRange && semver.gtr('0.60.0', validRange))) {
- return (await prompts({
- type: 'select',
- name: 'template',
- message: 'What version of react-native-windows would you like to install?',
- choices: [
- { value: 'vnext', title: ' [1mLatest[22m - High performance react-native-windows built on a shared C++ core from facebook (supports C++ or C#).' },
- { value: 'legacy', title: ' [1mLegacy[22m - Older react-native-windows implementation - (C# only, react-native <= 0.59 only)' },
- ],
- })).template;
- }
-
- // 0.60 releases all use the vnext tag
- if ((validVersion && semver.lt(validVersion, '0.61.0'))
- || (validRange && semver.gtr('0.61.0', validRange))) {
- return 'vnext';
- }
-
- // 0.61 and after don't tag stable releases
- return null;
-}
-
-module.exports = async function (config, args, options) {
- try {
- const name = args[0] || Common.getReactNativeAppName();
- const ns = options.namespace || name;
- const version = options.windowsVersion || Common.getReactNativeVersion();
- let rnwPackage = version;
- // If the version is a file: link, there's no need to compute what package to install.
- // This is useful when testing local changes to the repo that haven't been published yet.
- if (!version.startsWith("file:")) {
- const versionTag = options.template || await getDefaultVersionTag(version);
-
- rnwPackage = await Common.getInstallPackage(version, versionTag);
- }
-
- console.log(`Installing ${rnwPackage}...`);
- const pkgmgr = Common.isGlobalCliUsingYarn(process.cwd()) ? 'yarn add' : 'npm install --save';
-
- const execOptions = options.verbose ? { stdio: 'inherit' } : {};
- execSync(`${pkgmgr} ${rnwPackage}`, execOptions);
- console.log(chalk.green(`${rnwPackage} successfully installed.`));
-
- const generateWindows = require(REACT_NATIVE_WINDOWS_GENERATE_PATH());
- generateWindows(process.cwd(), name, ns, options);
- } catch (error) {
- console.error(chalk.red(error.message));
- console.error(error);
- process.exit(1);
- }
-};
diff --git a/packages/rnpm-plugin-windows/src/wpf.js b/packages/rnpm-plugin-windows/src/wpf.js
deleted file mode 100644
index 3a6821c2e30..00000000000
--- a/packages/rnpm-plugin-windows/src/wpf.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License.
- */
-'use strict';
-
-const Common = require('./common');
-const chalk = require('chalk');
-const execSync = require('child_process').execSync;
-const path = require('path');
-
-const REACT_NATIVE_WPF_GENERATE_PATH = function() {
- return path.resolve(
- process.cwd(),
- 'node_modules',
- 'react-native-windows',
- 'local-cli',
- 'generate-wpf.js'
- );
-};
-
-module.exports = function (config, args, options) {
- const name = args[0] ? args[0] : Common.getReactNativeAppName();
- const ns = options.namespace ? options.namespace : name;
- const version = options.windowsVersion ? options.windowsVersion : Common.getReactNativeVersion();
-
- // If the template is not set, look for a stable or 'rc' version
- const template = options.template ? options.template : 'rc';
-
- return Common.getInstallPackage(version, template)
- .then(rnwPackage => {
- console.log(`Installing ${rnwPackage}...`);
- const pkgmgr = Common.isGlobalCliUsingYarn(process.cwd()) ? 'yarn add' : 'npm install --save';
-
- const execOptions = options.verbose ? { stdio: 'inherit' } : {};
- execSync(`${pkgmgr} ${rnwPackage}`, execOptions);
- console.log(chalk.green(`${rnwPackage} successfully installed.`));
-
- const generateWPF = require(REACT_NATIVE_WPF_GENERATE_PATH());
- generateWPF(process.cwd(), name, ns, options);
- }).catch(error => console.error(chalk.red(error.message)));
-};
diff --git a/vnext/local-cli/runWindows/utils/info.js b/vnext/local-cli/runWindows/utils/info.js
index cf87af941c0..dd13c6d2e2a 100644
--- a/vnext/local-cli/runWindows/utils/info.js
+++ b/vnext/local-cli/runWindows/utils/info.js
@@ -16,7 +16,6 @@ async function getEnvironmentInfo() {
'react-native',
'react-native-windows',
'@react-native-community/cli',
- 'rnpm-plugin-windows',
'react-native-cli',
],
npmGlobalPackages: ['*react-native*'],
From edc1b872aff9646fe24e66ca7c2fefbf31738541 Mon Sep 17 00:00:00 2001
From: Jon Thysell
Date: Mon, 27 Apr 2020 10:56:45 -0700
Subject: [PATCH 004/209] Fixes husky missing error (#4727)
Closes #4726.
---
package.json | 1 +
yarn.lock | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 72 insertions(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 5974c76d111..93cabef865c 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,7 @@
},
"devDependencies": {
"beachball": "^1.13.4",
+ "husky": "^4.2.5",
"lerna": "^3.16.1"
},
"resolutions": {
diff --git a/yarn.lock b/yarn.lock
index 0ad06fd74de..ac94a5d1e08 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4952,6 +4952,14 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.3
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"
+chalk@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.0.0.tgz#6e98081ed2d17faab615eb52ac66ec1fe6209e72"
+ integrity sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==
+ dependencies:
+ ansi-styles "^4.1.0"
+ supports-color "^7.1.0"
+
chardet@^0.4.0:
version "0.4.2"
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"
@@ -5299,6 +5307,11 @@ compare-versions@^3.4.0:
resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.5.1.tgz#26e1f5cf0d48a77eced5046b9f67b6b61075a393"
integrity sha512-9fGPIB7C6AyM18CJJBHt5EnCZDG3oiTJYy0NjfIAGjKpzv0tkxWko7TNQHF5ymqm7IH03tqmeuBxtvD+Izh6mg==
+compare-versions@^3.6.0:
+ version "3.6.0"
+ resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.6.0.tgz#1a5689913685e5a87637b8d3ffca75514ec41d62"
+ integrity sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==
+
component-emitter@^1.2.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0"
@@ -6906,7 +6919,7 @@ find-up@^3.0.0:
dependencies:
locate-path "^3.0.0"
-find-up@^4.1.0:
+find-up@^4.0.0, find-up@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==
@@ -6914,6 +6927,13 @@ find-up@^4.1.0:
locate-path "^5.0.0"
path-exists "^4.0.0"
+find-versions@^3.2.0:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/find-versions/-/find-versions-3.2.0.tgz#10297f98030a786829681690545ef659ed1d254e"
+ integrity sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==
+ dependencies:
+ semver-regex "^2.0.0"
+
fkill@^6.0.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/fkill/-/fkill-6.2.0.tgz#a5c0ab65e0469578d0b648a86ac8526fc5ab5fa2"
@@ -7598,6 +7618,22 @@ humanize-ms@^1.2.1:
dependencies:
ms "^2.0.0"
+husky@^4.2.5:
+ version "4.2.5"
+ resolved "https://registry.yarnpkg.com/husky/-/husky-4.2.5.tgz#2b4f7622673a71579f901d9885ed448394b5fa36"
+ integrity sha512-SYZ95AjKcX7goYVZtVZF2i6XiZcHknw50iXvY7b0MiGoj5RwdgRQNEHdb+gPDPCXKlzwrybjFjkL6FOj8uRhZQ==
+ dependencies:
+ chalk "^4.0.0"
+ ci-info "^2.0.0"
+ compare-versions "^3.6.0"
+ cosmiconfig "^6.0.0"
+ find-versions "^3.2.0"
+ opencollective-postinstall "^2.0.2"
+ pkg-dir "^4.2.0"
+ please-upgrade-node "^3.2.0"
+ slash "^3.0.0"
+ which-pm-runs "^1.0.0"
+
iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
@@ -10684,6 +10720,11 @@ open@^6.2.0:
dependencies:
is-wsl "^1.1.0"
+opencollective-postinstall@^2.0.2:
+ version "2.0.2"
+ resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz#5657f1bede69b6e33a45939b061eb53d3c6c3a89"
+ integrity sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==
+
openssl-wrapper@^0.3.4:
version "0.3.4"
resolved "https://registry.yarnpkg.com/openssl-wrapper/-/openssl-wrapper-0.3.4.tgz#c01ec98e4dcd2b5dfe0b693f31827200e3b81b07"
@@ -11163,6 +11204,20 @@ pkg-dir@^3.0.0:
dependencies:
find-up "^3.0.0"
+pkg-dir@^4.2.0:
+ version "4.2.0"
+ resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3"
+ integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==
+ dependencies:
+ find-up "^4.0.0"
+
+please-upgrade-node@^3.2.0:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942"
+ integrity sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==
+ dependencies:
+ semver-compare "^1.0.0"
+
plist@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/plist/-/plist-3.0.1.tgz#a9b931d17c304e8912ef0ba3bdd6182baf2e1f8c"
@@ -12250,6 +12305,16 @@ selenium-webdriver@3.x:
tmp "0.0.30"
xml2js "^0.4.17"
+semver-compare@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc"
+ integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w=
+
+semver-regex@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-2.0.0.tgz#a93c2c5844539a770233379107b38c7b4ac9d338"
+ integrity sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==
+
"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0:
version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
@@ -13829,6 +13894,11 @@ which-module@^2.0.0:
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=
+which-pm-runs@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/which-pm-runs/-/which-pm-runs-1.0.0.tgz#670b3afbc552e0b55df6b7780ca74615f23ad1cb"
+ integrity sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=
+
which@1, which@^1.2.4, which@^1.2.9, which@^1.3.0, which@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
From 5034ff3a75a3381117714d805290776ff498597f Mon Sep 17 00:00:00 2001
From: "dependabot-preview[bot]"
<27856297+dependabot-preview[bot]@users.noreply.github.com>
Date: Mon, 27 Apr 2020 19:01:26 +0000
Subject: [PATCH 005/209] Bump semver from 7.1.3 to 7.3.2 (#4730)
---
yarn.lock | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/yarn.lock b/yarn.lock
index ac94a5d1e08..62232f1c43e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6661,7 +6661,7 @@ extract-github@0.0.x:
resolved "https://registry.yarnpkg.com/extract-github/-/extract-github-0.0.5.tgz#f542536db8c19b983a3bec9db96d2ef2a5ff1a86"
integrity sha1-9UJTbbjBm5g6O+yduW0u8qX/GoY=
-extract-zip@^1.6.0, extract-zip@^1.6.7:
+extract-zip@^1.6.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.7.0.tgz#556cc3ae9df7f452c493a0cfb51cc30277940927"
integrity sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==
@@ -12336,9 +12336,9 @@ semver@^6.0.0, semver@^6.1.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semve
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
semver@^7.1.3:
- version "7.1.3"
- resolved "https://registry.yarnpkg.com/semver/-/semver-7.1.3.tgz#e4345ce73071c53f336445cfc19efb1c311df2a6"
- integrity sha512-ekM0zfiA9SCBlsKa2X1hxyxiI4L3B6EbVJkkdgQXnSEEaHlGdvyodMruTiulSRWMMB4NeIuYNMC9rTKTz97GxA==
+ version "7.3.2"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938"
+ integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==
semver@~5.3.0:
version "5.3.0"
From ac3e39f11d2a6d614783cfbe82002946e81813e7 Mon Sep 17 00:00:00 2001
From: "dependabot-preview[bot]"
<27856297+dependabot-preview[bot]@users.noreply.github.com>
Date: Mon, 27 Apr 2020 19:01:37 +0000
Subject: [PATCH 006/209] Bump fp-ts from 2.5.3 to 2.5.4 (#4729)
---
yarn.lock | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/yarn.lock b/yarn.lock
index 62232f1c43e..ac0d93b847d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7018,9 +7018,9 @@ forwarded@~0.1.2:
integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=
fp-ts@^2.5.0:
- version "2.5.3"
- resolved "https://registry.yarnpkg.com/fp-ts/-/fp-ts-2.5.3.tgz#7f09cc7f3e09623c6ade303d98a2cccdb2cc861f"
- integrity sha512-lQd+hahLd8cygNoXbEHDjH/cbF6XVWlEPb8h5GXXlozjCSDxWgclvkpOoTRfBA0P+r69l9VvW1nEsSGIJRQpWw==
+ version "2.5.4"
+ resolved "https://registry.yarnpkg.com/fp-ts/-/fp-ts-2.5.4.tgz#f184079aaa78403ea66458517be7787e0d593429"
+ integrity sha512-cZlLeEneRYypc2dOzB9h8+bd9mQhJVyt2g0Dny2gKR7uWNgA4EmLSJyguLYsTU44nJSSG9EjurUalEc0wQqeKw==
fragment-cache@^0.2.1:
version "0.2.1"
From a8ab5f4663454a13bd0b4fd58e7f9e50d473f9fa Mon Sep 17 00:00:00 2001
From: "dependabot-preview[bot]"
<27856297+dependabot-preview[bot]@users.noreply.github.com>
Date: Mon, 27 Apr 2020 19:01:49 +0000
Subject: [PATCH 007/209] Bump envinfo from 7.5.0 to 7.5.1 (#4728)
---
yarn.lock | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/yarn.lock b/yarn.lock
index ac0d93b847d..298a946aa6a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6116,9 +6116,9 @@ env-variable@0.0.x:
integrity sha512-zoB603vQReOFvTg5xMl9I1P2PnHsHQQKTEowsKKD7nseUfJq6UWzK+4YtlWUO1nhiQUxe6XMkk+JleSZD1NZFA==
envinfo@^7.1.0, envinfo@^7.3.1, envinfo@^7.5.0:
- version "7.5.0"
- resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.5.0.tgz#91410bb6db262fb4f1409bd506e9ff57e91023f4"
- integrity sha512-jDgnJaF/Btomk+m3PZDTTCb5XIIIX3zYItnCRfF73zVgvinLoRomuhi75Y4su0PtQxWz4v66XnLLckyvyJTOIQ==
+ version "7.5.1"
+ resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.5.1.tgz#93c26897225a00457c75e734d354ea9106a72236"
+ integrity sha512-hQBkDf2iO4Nv0CNHpCuSBeaSrveU6nThVxFGTrq/eDlV716UQk09zChaJae4mZRsos1x4YLY2TaH3LHUae3ZmQ==
err-code@^1.0.0:
version "1.1.2"
From c440b35fa8bb9dd608a7a48cb84019655f75629d Mon Sep 17 00:00:00 2001
From: Andrew Coates <30809111+acoates-ms@users.noreply.github.com>
Date: Mon, 27 Apr 2020 16:47:25 -0700
Subject: [PATCH 008/209] Delete vnext\README.md and create a build task to
copy the root one to vnext\ (#4731)
* Use readme file from root of repo for react-native-windows
* Change files
---
README.md | 4 +--
...ve-windows-2020-04-27-11-58-10-readme.json | 8 +++++
vnext/.gitignore | 3 ++
vnext/README.md | 33 -------------------
vnext/just-task.js | 9 +++++
5 files changed, 22 insertions(+), 35 deletions(-)
create mode 100644 change/react-native-windows-2020-04-27-11-58-10-readme.json
delete mode 100644 vnext/README.md
diff --git a/README.md b/README.md
index cbc480fc7b1..5145a32ee2f 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
-
+
> See the official [React Native website](https://reactnative.dev/) for an introduction to React Native.
@@ -57,7 +57,7 @@ Search the [existing issues](https://github.com/microsoft/react-native-windows/i
The GitHub issues are intended for bug reports and feature requests. For help and questions with using the React Native Windows plugin please make use of the resources listed our main README's the [Getting Help](https://github.com/microsoft/react-native-windows#getting-help) section.
## Contributing
-See [Contributing guidelines](./docs/contributing.md) for how to setup your fork of the repo and start a PR to contribute to React Native for Windows.
+See [Contributing guidelines](https://github.com/microsoft/react-native-windows/blob/master/docs/contributing.md) for how to setup your fork of the repo and start a PR to contribute to React Native for Windows.
[Good First Task](https://github.com/microsoft/react-native-windows/labels/Good%20First%20Task) and [help wanted](https://github.com/microsoft/react-native-windows/labels/help%20wanted) are great starting points for PRs.
diff --git a/change/react-native-windows-2020-04-27-11-58-10-readme.json b/change/react-native-windows-2020-04-27-11-58-10-readme.json
new file mode 100644
index 00000000000..2ca20ee2410
--- /dev/null
+++ b/change/react-native-windows-2020-04-27-11-58-10-readme.json
@@ -0,0 +1,8 @@
+{
+ "type": "prerelease",
+ "comment": "Use readme file from root of repo for react-native-windows",
+ "packageName": "react-native-windows",
+ "email": "acoates@microsoft.com",
+ "dependentChangeType": "patch",
+ "date": "2020-04-27T18:58:10.453Z"
+}
diff --git a/vnext/.gitignore b/vnext/.gitignore
index 6377e5c79c4..30a7d146fa2 100644
--- a/vnext/.gitignore
+++ b/vnext/.gitignore
@@ -85,3 +85,6 @@ temp
/coverage
/third-party
/packages/
+
+# Copied from root as part of build
+/README.md
\ No newline at end of file
diff --git a/vnext/README.md b/vnext/README.md
deleted file mode 100644
index eed88ab92d0..00000000000
--- a/vnext/README.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# ReactNative for Windows
-
-
-> See the official [React Native website](https://facebook.github.io/react-native/) for an introduction to React Native. See [main landing page](https://github.com/microsoft/react-native-windows) for more details on overall direction of `react-native-windows`.
-
-[React Native](https://reactnative.dev) is a framework developed by Facebook that enables you to build world-class application experiences on native platforms using a consistent developer experience based on JavaScript and [React](https://reactjs.org/). The focus of React Native is on developer efficiency across all the platforms you care about - learn once, write anywhere.
-
-This repository adds support for the [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads), which allows you to build apps for [all devices supported by Windows 10](https://developer.microsoft.com/en-us/windows/get-started-windows-10) including PCs, tablets, 2-in-1s, Xbox, Mixed reality devices etc.
-
-## Status and roadmap
-[Check out our blog](https://microsoft.github.io/react-native-windows/blog/) If you'd like to stay up to date on the status of React Native for Windows and check out current and past roadmaps, We will post all new releases, updates and general news about the project there.
-
-## Documentation
-[React Native already has great documentation](https://reactnative.dev/docs/getting-started.html) and we're working to ensure the React Native Windows is part of that documentation story.
-
-[React Native for Windows](https://microsoft.github.io/react-native-windows/) has it's own separate documentation site where Windows and Mac specific information, like API docs and blog updates live.
-
-## Getting Started
-See [Getting Started Guide for React Native Windows C++](https://microsoft.github.io/react-native-windows/docs/getting-started).
-
-## Opening issues
-If you encounter a bug with the React Native Windows plugin, we would like to hear about it!
-
-Search the [existing issues](https://github.com/microsoft/react-native-windows/issues) and try to make sure your problem doesn’t already exist before opening a new issue. If your issue doesn't exist yet, try to make sure you provide as much information as possible to us so we can help you sooner. It’s helpful if you include information like:
-
-- The version of Windows, React Native, React Native Windows plugin, and device family (i.e., mobile, desktop, Xbox, etc.) where you ran into the issue.
-- A stack trace and reduced repro case when possible.
-- Ensure the [appropriate template](https://github.com/microsoft/react-native-windows/issues/new?labels=vnext&template=vnext.md) is used when filing your issue(s).
-
-The GitHub issues are intended for bug reports and feature requests. For help and questions with using the React Native Windows plugin please make use of the resources listed our main README's the [Getting Help](https://github.com/microsoft/react-native-windows#getting-help) section.
-
-## Contributing
-See [Contributing guidelines](./docs/CONTRIBUTING.md) for how to setup your fork of the repo and start a PR to contribute to React Native Windows vNext.
diff --git a/vnext/just-task.js b/vnext/just-task.js
index dc0c2e9a25e..bf440f6c14f 100644
--- a/vnext/just-task.js
+++ b/vnext/just-task.js
@@ -20,6 +20,7 @@ const {
cleanTask,
} = require('just-scripts');
const {execSync} = require('child_process');
+const fs = require('fs');
const libPath = path.resolve(process.cwd(), 'lib');
const srcPath = path.resolve(process.cwd(), 'src');
@@ -61,6 +62,13 @@ task('initRNLibraries', () => {
require('./Scripts/copyRNLibraries').copyRNLibraries(__dirname);
});
+task('copyReadmeFromRoot', () => {
+ fs.copyFileSync(
+ path.resolve(__dirname, '../README.md'),
+ path.resolve(__dirname, 'README.md'),
+ );
+});
+
task('ts', () => {
return tscTask({
pretty: true,
@@ -86,6 +94,7 @@ task(
condition('clean', () => true || argv().clean),
'initRNLibraries',
'copyFlowFiles',
+ 'copyReadmeFromRoot',
'ts',
'codegen',
condition('apiExtractorVerify', () => argv().ci),
From 2453f8e8ea999c28912a23a0838d2505629c3098 Mon Sep 17 00:00:00 2001
From: React-Native-Windows Bot <53619745+rnbot@users.noreply.github.com>
Date: Tue, 28 Apr 2020 00:04:13 +0000
Subject: [PATCH 009/209] applying package updates ***NO_CI***
---
...ative-win32-2020-04-27-09-42-09-uprex.json | 8 -----
...020-04-26-21-09-42-MS_Cs_ReactContext.json | 8 -----
...e-windows-2020-04-27-09-14-14-delrnpm.json | 8 -----
...ve-windows-2020-04-27-11-58-10-readme.json | 8 -----
packages/E2ETest/package.json | 2 +-
.../package.json | 2 +-
packages/playground/package.json | 2 +-
packages/react-native-win32/CHANGELOG.json | 15 ++++++++++
vnext/CHANGELOG.json | 29 +++++++++++++++++++
vnext/CHANGELOG.md | 11 ++++++-
vnext/package.json | 2 +-
11 files changed, 58 insertions(+), 37 deletions(-)
delete mode 100644 change/@office-iss-react-native-win32-2020-04-27-09-42-09-uprex.json
delete mode 100644 change/react-native-windows-2020-04-26-21-09-42-MS_Cs_ReactContext.json
delete mode 100644 change/react-native-windows-2020-04-27-09-14-14-delrnpm.json
delete mode 100644 change/react-native-windows-2020-04-27-11-58-10-readme.json
diff --git a/change/@office-iss-react-native-win32-2020-04-27-09-42-09-uprex.json b/change/@office-iss-react-native-win32-2020-04-27-09-42-09-uprex.json
deleted file mode 100644
index 6cb87e75fcd..00000000000
--- a/change/@office-iss-react-native-win32-2020-04-27-09-42-09-uprex.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "type": "none",
- "comment": "Update rex-win32 version to something more recent",
- "packageName": "@office-iss/react-native-win32",
- "email": "acoates@microsoft.com",
- "dependentChangeType": "none",
- "date": "2020-04-27T16:42:09.664Z"
-}
diff --git a/change/react-native-windows-2020-04-26-21-09-42-MS_Cs_ReactContext.json b/change/react-native-windows-2020-04-26-21-09-42-MS_Cs_ReactContext.json
deleted file mode 100644
index 76cefbe6c3f..00000000000
--- a/change/react-native-windows-2020-04-26-21-09-42-MS_Cs_ReactContext.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "type": "prerelease",
- "comment": "Added C# ReactContext for Module Initialize method",
- "packageName": "react-native-windows",
- "email": "vmorozov@microsoft.com",
- "dependentChangeType": "patch",
- "date": "2020-04-27T04:09:42.583Z"
-}
diff --git a/change/react-native-windows-2020-04-27-09-14-14-delrnpm.json b/change/react-native-windows-2020-04-27-09-14-14-delrnpm.json
deleted file mode 100644
index 4b5933ed081..00000000000
--- a/change/react-native-windows-2020-04-27-09-14-14-delrnpm.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "type": "none",
- "comment": "Remove rnpm-plugin-windows",
- "packageName": "react-native-windows",
- "email": "acoates@microsoft.com",
- "dependentChangeType": "none",
- "date": "2020-04-27T16:14:12.892Z"
-}
diff --git a/change/react-native-windows-2020-04-27-11-58-10-readme.json b/change/react-native-windows-2020-04-27-11-58-10-readme.json
deleted file mode 100644
index 2ca20ee2410..00000000000
--- a/change/react-native-windows-2020-04-27-11-58-10-readme.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "type": "prerelease",
- "comment": "Use readme file from root of repo for react-native-windows",
- "packageName": "react-native-windows",
- "email": "acoates@microsoft.com",
- "dependentChangeType": "patch",
- "date": "2020-04-27T18:58:10.453Z"
-}
diff --git a/packages/E2ETest/package.json b/packages/E2ETest/package.json
index 4f080c7ea22..fa480484cbd 100644
--- a/packages/E2ETest/package.json
+++ b/packages/E2ETest/package.json
@@ -25,7 +25,7 @@
"prompt-sync": "^4.2.0",
"react": "16.9.0",
"react-native": "0.62.2",
- "react-native-windows": "0.0.0-master.50"
+ "react-native-windows": "0.0.0-master.51"
},
"devDependencies": {
"@babel/core": "^7.8.4",
diff --git a/packages/microsoft-reactnative-sampleapps/package.json b/packages/microsoft-reactnative-sampleapps/package.json
index 7889e67990c..7f23d6ee126 100644
--- a/packages/microsoft-reactnative-sampleapps/package.json
+++ b/packages/microsoft-reactnative-sampleapps/package.json
@@ -16,7 +16,7 @@
"dependencies": {
"react": "16.9.0",
"react-native": "0.62.2",
- "react-native-windows": "0.0.0-master.50"
+ "react-native-windows": "0.0.0-master.51"
},
"devDependencies": {
"@babel/core": "^7.8.4",
diff --git a/packages/playground/package.json b/packages/playground/package.json
index 098dc6aed60..e94fc798c83 100644
--- a/packages/playground/package.json
+++ b/packages/playground/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"react": "16.9.0",
"react-native": "0.62.2",
- "react-native-windows": "0.0.0-master.50"
+ "react-native-windows": "0.0.0-master.51"
},
"devDependencies": {
"@babel/core": "^7.8.4",
diff --git a/packages/react-native-win32/CHANGELOG.json b/packages/react-native-win32/CHANGELOG.json
index 3c83cf0780f..8ee394f3883 100644
--- a/packages/react-native-win32/CHANGELOG.json
+++ b/packages/react-native-win32/CHANGELOG.json
@@ -1,6 +1,21 @@
{
"name": "@office-iss/react-native-win32",
"entries": [
+ {
+ "date": "Tue, 28 Apr 2020 00:04:13 GMT",
+ "tag": "@office-iss/react-native-win32_v0.0.0-master.6",
+ "version": "0.0.0-master.6",
+ "comments": {
+ "none": [
+ {
+ "comment": "Update rex-win32 version to something more recent",
+ "author": "acoates@microsoft.com",
+ "commit": "fc72e04428dff1c31acdb9183f3ce95a0a5a53c1",
+ "package": "@office-iss/react-native-win32"
+ }
+ ]
+ }
+ },
{
"date": "Sat, 18 Apr 2020 00:04:34 GMT",
"tag": "@office-iss/react-native-win32_v0.0.0-master.6",
diff --git a/vnext/CHANGELOG.json b/vnext/CHANGELOG.json
index 30b3eccd58f..33b68acc93c 100644
--- a/vnext/CHANGELOG.json
+++ b/vnext/CHANGELOG.json
@@ -1,6 +1,35 @@
{
"name": "react-native-windows",
"entries": [
+ {
+ "date": "Tue, 28 Apr 2020 00:04:13 GMT",
+ "tag": "react-native-windows_v0.0.0-master.51",
+ "version": "0.0.0-master.51",
+ "comments": {
+ "prerelease": [
+ {
+ "comment": "Added C# ReactContext for Module Initialize method",
+ "author": "vmorozov@microsoft.com",
+ "commit": "51368d02d2d0961411707c40901bf8d1bb20e1c4",
+ "package": "react-native-windows"
+ },
+ {
+ "comment": "Use readme file from root of repo for react-native-windows",
+ "author": "acoates@microsoft.com",
+ "commit": "c440b35fa8bb9dd608a7a48cb84019655f75629d",
+ "package": "react-native-windows"
+ }
+ ],
+ "none": [
+ {
+ "comment": "Remove rnpm-plugin-windows",
+ "author": "acoates@microsoft.com",
+ "commit": "793ec2523ab10db23def810a2f41f68957766941",
+ "package": "react-native-windows"
+ }
+ ]
+ }
+ },
{
"date": "Mon, 27 Apr 2020 00:04:59 GMT",
"tag": "react-native-windows_v0.0.0-master.50",
diff --git a/vnext/CHANGELOG.md b/vnext/CHANGELOG.md
index 8ecfa6664aa..5a00ceb2719 100644
--- a/vnext/CHANGELOG.md
+++ b/vnext/CHANGELOG.md
@@ -1,9 +1,18 @@
# Change Log - react-native-windows
-This log was last generated on Mon, 27 Apr 2020 00:04:59 GMT and should not be manually modified.
+This log was last generated on Tue, 28 Apr 2020 00:04:13 GMT and should not be manually modified.
+## 0.0.0-master.51
+
+Tue, 28 Apr 2020 00:04:13 GMT
+
+### Changes
+
+- Added C# ReactContext for Module Initialize method (vmorozov@microsoft.com)
+- Use readme file from root of repo for react-native-windows (acoates@microsoft.com)
+
## 0.0.0-master.50
Mon, 27 Apr 2020 00:04:59 GMT
diff --git a/vnext/package.json b/vnext/package.json
index d4769198121..78e485fc0a1 100644
--- a/vnext/package.json
+++ b/vnext/package.json
@@ -1,6 +1,6 @@
{
"name": "react-native-windows",
- "version": "0.0.0-master.50",
+ "version": "0.0.0-master.51",
"license": "MIT",
"repository": {
"type": "git",
From 567fc48cf6858ece96ff60fcd52e20cded72cbfc Mon Sep 17 00:00:00 2001
From: Alexander Sklar
Date: Mon, 27 Apr 2020 21:34:15 -0700
Subject: [PATCH 010/209] =?UTF-8?q?Start=20migrating=20WUX=20=F0=9F=91=89?=
=?UTF-8?q?=20MUX=20(#4715)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Start forking namespace and includes for WUX->MUX move
* move C++/WinRT code to use xaml instead of winrt::Windows::UI::Xaml
* move to comp instead of winrt::Windows::UI::Composition
* .
* Change files
* fix merge
* Redirect IDL types too
* format and fix jsvaluexaml
* use XAML_NAMESPACE macro in IDL
* PR feedback
* format
* convert include to forward slashes
---
...ve-windows-2020-04-25-00-45-24-wuxmux.json | 8 +
.../ReactModuleBuilderMock.h | 5 +-
vnext/Microsoft.ReactNative.Cxx/JSValueXaml.h | 4 +-
.../Microsoft.ReactNative/ABIViewManager.cpp | 31 +-
vnext/Microsoft.ReactNative/ABIViewManager.h | 19 +-
vnext/Microsoft.ReactNative/IReactContext.cpp | 2 +-
vnext/Microsoft.ReactNative/IReactContext.h | 2 +-
vnext/Microsoft.ReactNative/IReactContext.idl | 4 +-
vnext/Microsoft.ReactNative/IViewManager.idl | 16 +-
.../Modules/AppStateData.cpp | 2 +-
.../Modules/AppStateData.h | 5 +-
.../ReactApplication.cpp | 7 +-
.../Microsoft.ReactNative/ReactApplication.h | 2 +-
.../ReactApplication.idl | 3 +-
.../ReactApplicationDelegate.cpp | 2 +-
.../ReactApplicationDelegate.h | 6 +-
.../ReactApplicationDelegate.idl | 5 +-
.../Microsoft.ReactNative/ReactNativeHost.cpp | 4 +-
vnext/Microsoft.ReactNative/ReactRootView.idl | 3 +-
vnext/Microsoft.ReactNative/RedBox.cpp | 10 +-
.../Views/ReactRootControl.cpp | 85 ++-
.../Views/ReactRootControl.h | 13 +-
vnext/Microsoft.ReactNative/XamlHelper.cpp | 2 +-
vnext/Microsoft.ReactNative/XamlHelper.h | 2 +-
vnext/Microsoft.ReactNative/XamlHelper.idl | 3 +-
vnext/Microsoft.ReactNative/pch.h | 12 +-
vnext/ReactUWP/ABI/ReactControl_rt.cpp | 3 +-
vnext/ReactUWP/Modules/AlertModuleUwp.cpp | 5 +-
.../Modules/Animated/AdditionAnimatedNode.cpp | 2 +-
.../Modules/Animated/AnimationDriver.h | 6 +-
.../Animated/CalculatedAnimationDriver.cpp | 6 +-
.../Animated/CalculatedAnimationDriver.h | 2 +-
.../Animated/DiffClampAnimatedNode.cpp | 2 +-
.../Modules/Animated/DivisionAnimatedNode.cpp | 2 +-
.../Modules/Animated/FrameAnimationDriver.cpp | 6 +-
.../Modules/Animated/FrameAnimationDriver.h | 2 +-
.../Animated/InterpolationAnimatedNode.cpp | 6 +-
.../Animated/InterpolationAnimatedNode.h | 6 +-
.../Modules/Animated/ModulusAnimatedNode.cpp | 2 +-
.../Animated/MultiplicationAnimatedNode.cpp | 2 +-
.../Modules/Animated/PropsAnimatedNode.cpp | 14 +-
.../Modules/Animated/PropsAnimatedNode.h | 12 +-
.../Animated/SubtractionAnimatedNode.cpp | 2 +-
.../Modules/Animated/ValueAnimatedNode.cpp | 4 +-
.../Modules/Animated/ValueAnimatedNode.h | 6 +-
vnext/ReactUWP/Modules/AppStateModuleUwp.cpp | 10 +-
vnext/ReactUWP/Modules/AppStateModuleUwp.h | 5 +-
vnext/ReactUWP/Modules/AppThemeModuleUwp.cpp | 2 +-
vnext/ReactUWP/Modules/AppThemeModuleUwp.h | 2 +-
vnext/ReactUWP/Modules/AppearanceModule.cpp | 4 +-
vnext/ReactUWP/Modules/AppearanceModule.h | 2 +-
vnext/ReactUWP/Modules/DeviceInfoModule.cpp | 4 +-
vnext/ReactUWP/Modules/DeviceInfoModule.h | 1 -
.../Modules/ImageViewManagerModule.cpp | 4 +-
vnext/ReactUWP/Modules/NativeUIManager.cpp | 56 +-
vnext/ReactUWP/Modules/NativeUIManager.h | 8 +-
vnext/ReactUWP/Modules/TimingModule.cpp | 5 +-
vnext/ReactUWP/Modules/TimingModule.h | 4 +-
vnext/ReactUWP/Pch/pch.h | 8 +-
.../Polyester/ButtonContentViewManager.cpp | 22 +-
.../ReactUWP/Polyester/ButtonViewManager.cpp | 3 -
vnext/ReactUWP/Polyester/ButtonViewManager.h | 2 +-
.../Polyester/ContentControlViewManager.cpp | 26 +-
.../Polyester/HyperlinkViewManager.cpp | 11 +-
vnext/ReactUWP/Polyester/IconViewManager.cpp | 11 +-
vnext/ReactUWP/Utils/AccessibilityUtils.cpp | 21 +-
vnext/ReactUWP/Utils/Helpers.cpp | 11 +-
vnext/ReactUWP/Utils/ResourceBrushUtils.cpp | 69 +--
vnext/ReactUWP/Utils/ValueUtils.cpp | 46 +-
.../Views/ActivityIndicatorViewManager.cpp | 6 +-
vnext/ReactUWP/Views/CheckboxViewManager.cpp | 16 +-
vnext/ReactUWP/Views/ControlViewManager.cpp | 39 +-
.../ReactUWP/Views/DatePickerViewManager.cpp | 24 +-
.../ReactUWP/Views/DynamicAutomationPeer.cpp | 21 +-
vnext/ReactUWP/Views/DynamicAutomationPeer.h | 35 +-
.../Views/DynamicAutomationProperties.cpp | 115 ++--
.../Views/DynamicAutomationProperties.h | 72 ++-
.../Views/ExpressionAnimationStore.cpp | 15 +-
.../ReactUWP/Views/ExpressionAnimationStore.h | 10 +-
vnext/ReactUWP/Views/FlyoutViewManager.cpp | 43 +-
.../Views/FrameworkElementViewManager.cpp | 109 ++--
.../ReactUWP/Views/Image/ImageViewManager.cpp | 3 +-
vnext/ReactUWP/Views/Image/ImageViewManager.h | 4 +-
vnext/ReactUWP/Views/Image/ReactImage.cpp | 8 +-
vnext/ReactUWP/Views/Image/ReactImage.h | 24 +-
.../ReactUWP/Views/Image/ReactImageBrush.cpp | 46 +-
vnext/ReactUWP/Views/Image/ReactImageBrush.h | 19 +-
.../Impl/ScrollViewUWPImplementation.cpp | 2 +-
.../Views/Impl/ScrollViewUWPImplementation.h | 7 +-
.../Impl/SnapPointManagingContentControl.cpp | 4 +-
.../Impl/SnapPointManagingContentControl.h | 16 +-
vnext/ReactUWP/Views/KeyboardEventHandler.cpp | 542 +++++++++---------
vnext/ReactUWP/Views/PickerViewManager.cpp | 23 +-
vnext/ReactUWP/Views/PopupViewManager.cpp | 34 +-
vnext/ReactUWP/Views/RawTextViewManager.cpp | 10 +-
vnext/ReactUWP/Views/ReactControl.cpp | 39 +-
vnext/ReactUWP/Views/ReactControl.h | 13 +-
vnext/ReactUWP/Views/ReactRootView.cpp | 12 +-
.../ReactUWP/Views/RefreshControlManager.cpp | 6 +-
vnext/ReactUWP/Views/RootViewManager.cpp | 8 +-
vnext/ReactUWP/Views/SIPEventHandler.cpp | 11 +-
vnext/ReactUWP/Views/SIPEventHandler.h | 2 +-
vnext/ReactUWP/Views/ScrollViewManager.cpp | 6 +-
vnext/ReactUWP/Views/ShadowNodeBase.cpp | 13 +-
vnext/ReactUWP/Views/SliderViewManager.cpp | 10 +-
vnext/ReactUWP/Views/SwitchViewManager.cpp | 9 +-
vnext/ReactUWP/Views/TextInputViewManager.cpp | 319 ++++++-----
vnext/ReactUWP/Views/TextViewManager.cpp | 59 +-
vnext/ReactUWP/Views/TouchEventHandler.cpp | 40 +-
vnext/ReactUWP/Views/TouchEventHandler.h | 22 +-
vnext/ReactUWP/Views/ViewControl.cpp | 10 +-
vnext/ReactUWP/Views/ViewControl.h | 5 +-
vnext/ReactUWP/Views/ViewManagerBase.cpp | 16 +-
vnext/ReactUWP/Views/ViewPanel.cpp | 89 ++-
vnext/ReactUWP/Views/ViewPanel.h | 69 +--
vnext/ReactUWP/Views/ViewViewManager.cpp | 36 +-
vnext/ReactUWP/Views/ViewViewManager.h | 4 -
.../ReactUWP/Views/VirtualTextViewManager.cpp | 8 +-
.../Views/cppwinrt/DynamicAutomationPeer.idl | 225 ++++----
vnext/ReactUWP/Views/cppwinrt/ViewPanel.idl | 80 +--
.../UniversalTestInstance.cpp | 22 +-
.../UniversalTestRunner.cpp | 8 +-
vnext/include/CppWinRTIncludes.h | 61 +-
vnext/include/Include.vcxitems | 3 +
vnext/include/Include.vcxitems.filters | 3 +
vnext/include/NamespaceRedirect.h | 7 +
.../ReactUWP/Utils/AccessibilityUtils.h | 12 +-
vnext/include/ReactUWP/Utils/Helpers.h | 7 +-
vnext/include/ReactUWP/Utils/PropertyUtils.h | 54 +-
.../ReactUWP/Utils/ResourceBrushUtils.h | 32 +-
vnext/include/ReactUWP/Utils/ValueUtils.h | 15 +-
.../Views/FrameworkElementViewManager.h | 14 +-
.../ReactUWP/Views/KeyboardEventHandler.h | 41 +-
vnext/include/ReactUWP/Views/ShadowNodeBase.h | 4 +-
vnext/include/ReactUWP/XamlView.h | 19 +-
135 files changed, 1605 insertions(+), 1739 deletions(-)
create mode 100644 change/react-native-windows-2020-04-25-00-45-24-wuxmux.json
create mode 100644 vnext/include/NamespaceRedirect.h
diff --git a/change/react-native-windows-2020-04-25-00-45-24-wuxmux.json b/change/react-native-windows-2020-04-25-00-45-24-wuxmux.json
new file mode 100644
index 00000000000..3bcc1973610
--- /dev/null
+++ b/change/react-native-windows-2020-04-25-00-45-24-wuxmux.json
@@ -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"
+}
diff --git a/vnext/Microsoft.ReactNative.Cxx.UnitTests/ReactModuleBuilderMock.h b/vnext/Microsoft.ReactNative.Cxx.UnitTests/ReactModuleBuilderMock.h
index 88ec6935f02..f610d8df4d1 100644
--- a/vnext/Microsoft.ReactNative.Cxx.UnitTests/ReactModuleBuilderMock.h
+++ b/vnext/Microsoft.ReactNative.Cxx.UnitTests/ReactModuleBuilderMock.h
@@ -7,13 +7,12 @@
#include "future/future.h"
#include
+#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 {
@@ -122,7 +121,7 @@ struct ReactContextMock : implements {
ReactContextMock(ReactModuleBuilderMock *builderMock) noexcept;
void DispatchEvent(
- FrameworkElement const & /*view*/,
+ xaml::FrameworkElement const & /*view*/,
hstring const & /*eventName*/,
JSValueArgWriter const & /*eventDataArgWriter*/) noexcept {}
diff --git a/vnext/Microsoft.ReactNative.Cxx/JSValueXaml.h b/vnext/Microsoft.ReactNative.Cxx/JSValueXaml.h
index 4e98754e53f..ea2ccde92c3 100644
--- a/vnext/Microsoft.ReactNative.Cxx/JSValueXaml.h
+++ b/vnext/Microsoft.ReactNative.Cxx/JSValueXaml.h
@@ -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); });
}
diff --git a/vnext/Microsoft.ReactNative/ABIViewManager.cpp b/vnext/Microsoft.ReactNative/ABIViewManager.cpp
index 907d4365c4e..5cecd2ec457 100644
--- a/vnext/Microsoft.ReactNative/ABIViewManager.cpp
+++ b/vnext/Microsoft.ReactNative/ABIViewManager.cpp
@@ -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;
}
@@ -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();
+ auto view = nodeToUpdate->GetView().as();
IJSValueReader propertyMapReader = winrt::make(reactDiffMap);
@@ -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();
+ auto view = viewToUpdate.as();
IJSValueReader argReader = winrt::make(commandArgs);
m_viewManagerWithCommands.DispatchCommand(view, to_hstring(commandId), argReader);
@@ -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(), child.as(), index);
+ m_viewManagerWithChildren.AddView(parent.as(), child.as(), 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());
+ m_viewManagerWithChildren.RemoveAllChildren(parent.as());
} 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(), index);
+ m_viewManagerWithChildren.RemoveChildAt(parent.as(), 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(), oldChild.as(), newChild.as());
+ parent.as(), oldChild.as(), newChild.as());
} else {
Super::ReplaceChild(parent, oldChild, newChild);
}
diff --git a/vnext/Microsoft.ReactNative/ABIViewManager.h b/vnext/Microsoft.ReactNative/ABIViewManager.h
index 4709e00bba7..0f2e8feb2a3 100644
--- a/vnext/Microsoft.ReactNative/ABIViewManager.h
+++ b/vnext/Microsoft.ReactNative/ABIViewManager.h
@@ -39,7 +39,7 @@ 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;
@@ -47,19 +47,16 @@ class ABIViewManager : public react::uwp::FrameworkElementViewManager {
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;
diff --git a/vnext/Microsoft.ReactNative/IReactContext.cpp b/vnext/Microsoft.ReactNative/IReactContext.cpp
index 9c959208fec..1215bea4d59 100644
--- a/vnext/Microsoft.ReactNative/IReactContext.cpp
+++ b/vnext/Microsoft.ReactNative/IReactContext.cpp
@@ -10,7 +10,7 @@ namespace winrt::Microsoft::ReactNative {
ReactContext::ReactContext(Mso::CntPtr &&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
diff --git a/vnext/Microsoft.ReactNative/IReactContext.h b/vnext/Microsoft.ReactNative/IReactContext.h
index ffe1e0c48ae..018619414c8 100644
--- a/vnext/Microsoft.ReactNative/IReactContext.h
+++ b/vnext/Microsoft.ReactNative/IReactContext.h
@@ -13,7 +13,7 @@ struct ReactContext : winrt::implements {
public: // IReactContext
void DispatchEvent(
- winrt::Windows::UI::Xaml::FrameworkElement const &view,
+ xaml::FrameworkElement const &view,
hstring const &eventName,
JSValueArgWriter const &eventDataArgWriter) noexcept;
void CallJSFunction(
diff --git a/vnext/Microsoft.ReactNative/IReactContext.idl b/vnext/Microsoft.ReactNative/IReactContext.idl
index 36a7297dc7e..b2b85ce3bc0 100644
--- a/vnext/Microsoft.ReactNative/IReactContext.idl
+++ b/vnext/Microsoft.ReactNative/IReactContext.idl
@@ -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);
}
diff --git a/vnext/Microsoft.ReactNative/IViewManager.idl b/vnext/Microsoft.ReactNative/IViewManager.idl
index 226bcf9703d..e1d877dcb4d 100644
--- a/vnext/Microsoft.ReactNative/IViewManager.idl
+++ b/vnext/Microsoft.ReactNative/IViewManager.idl
@@ -4,6 +4,8 @@
import "IReactModuleBuilder.idl";
import "IReactContext.idl";
+#include "../Include/NamespaceRedirect.h"
+
namespace Microsoft.ReactNative
{
[webhosthidden]
@@ -22,7 +24,7 @@ namespace Microsoft.ReactNative
{
String Name { get; };
- Windows.UI.Xaml.FrameworkElement CreateView();
+ XAML_NAMESPACE.FrameworkElement CreateView();
}
[webhosthidden]
@@ -42,7 +44,7 @@ namespace Microsoft.ReactNative
{
IMapView NativeProps { get; };
- void UpdateProperties(Windows.UI.Xaml.FrameworkElement view, IJSValueReader propertyMapReader);
+ void UpdateProperties(XAML_NAMESPACE.FrameworkElement view, IJSValueReader propertyMapReader);
}
[webhosthidden]
@@ -50,7 +52,7 @@ namespace Microsoft.ReactNative
{
IVectorView Commands { get; };
- void DispatchCommand(Windows.UI.Xaml.FrameworkElement view, String commandId, IJSValueReader commandArgsReader);
+ void DispatchCommand(XAML_NAMESPACE.FrameworkElement view, String commandId, IJSValueReader commandArgsReader);
}
[webhosthidden]
@@ -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
diff --git a/vnext/Microsoft.ReactNative/Modules/AppStateData.cpp b/vnext/Microsoft.ReactNative/Modules/AppStateData.cpp
index 97de89ded5c..3f980dcbd45 100644
--- a/vnext/Microsoft.ReactNative/Modules/AppStateData.cpp
+++ b/vnext/Microsoft.ReactNative/Modules/AppStateData.cpp
@@ -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 {
diff --git a/vnext/Microsoft.ReactNative/Modules/AppStateData.h b/vnext/Microsoft.ReactNative/Modules/AppStateData.h
index 9c446b8897f..ff400f8af81 100644
--- a/vnext/Microsoft.ReactNative/Modules/AppStateData.h
+++ b/vnext/Microsoft.ReactNative/Modules/AppStateData.h
@@ -6,7 +6,6 @@
#include
#include
#include
-#include
#include "ReactHost/React.h"
#include "activeObject/activeObject.h"
@@ -30,8 +29,8 @@ struct AppStateData : Mso::ActiveObject<> {
std::mutex m_stateMutex;
char const *m_lastState{nullptr};
Mso::CntPtr 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
diff --git a/vnext/Microsoft.ReactNative/ReactApplication.cpp b/vnext/Microsoft.ReactNative/ReactApplication.cpp
index 89a51d7f44e..38c271ddb6c 100644
--- a/vnext/Microsoft.ReactNative/ReactApplication.cpp
+++ b/vnext/Microsoft.ReactNative/ReactApplication.cpp
@@ -9,7 +9,6 @@
#include
#include
-#include
using namespace winrt;
using namespace Windows::ApplicationModel;
@@ -17,9 +16,9 @@ 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 {
diff --git a/vnext/Microsoft.ReactNative/ReactApplication.h b/vnext/Microsoft.ReactNative/ReactApplication.h
index 7b5ba195e9f..1bb0e357aa8 100644
--- a/vnext/Microsoft.ReactNative/ReactApplication.h
+++ b/vnext/Microsoft.ReactNative/ReactApplication.h
@@ -38,7 +38,7 @@ struct ReactApplication : ReactApplicationT {
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();
diff --git a/vnext/Microsoft.ReactNative/ReactApplication.idl b/vnext/Microsoft.ReactNative/ReactApplication.idl
index 2cb38257cf7..b554783f0bb 100644
--- a/vnext/Microsoft.ReactNative/ReactApplication.idl
+++ b/vnext/Microsoft.ReactNative/ReactApplication.idl
@@ -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; };
diff --git a/vnext/Microsoft.ReactNative/ReactApplicationDelegate.cpp b/vnext/Microsoft.ReactNative/ReactApplicationDelegate.cpp
index d4619d9d879..4413345823c 100644
--- a/vnext/Microsoft.ReactNative/ReactApplicationDelegate.cpp
+++ b/vnext/Microsoft.ReactNative/ReactApplicationDelegate.cpp
@@ -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;
diff --git a/vnext/Microsoft.ReactNative/ReactApplicationDelegate.h b/vnext/Microsoft.ReactNative/ReactApplicationDelegate.h
index 1550ea53679..4aadc8b89c2 100644
--- a/vnext/Microsoft.ReactNative/ReactApplicationDelegate.h
+++ b/vnext/Microsoft.ReactNative/ReactApplicationDelegate.h
@@ -9,10 +9,10 @@ namespace winrt::Microsoft::ReactNative::implementation {
struct ReactApplicationDelegate : ReactApplicationDelegateT {
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;
@@ -25,7 +25,7 @@ struct ReactApplicationDelegate : ReactApplicationDelegateT m_reactRootView{nullptr};
};
diff --git a/vnext/Microsoft.ReactNative/ReactApplicationDelegate.idl b/vnext/Microsoft.ReactNative/ReactApplicationDelegate.idl
index 6799920264b..a7bf51ddbff 100644
--- a/vnext/Microsoft.ReactNative/ReactApplicationDelegate.idl
+++ b/vnext/Microsoft.ReactNative/ReactApplicationDelegate.idl
@@ -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);
}
}
diff --git a/vnext/Microsoft.ReactNative/ReactNativeHost.cpp b/vnext/Microsoft.ReactNative/ReactNativeHost.cpp
index 89e3e986ce9..61ed3d4e4a4 100644
--- a/vnext/Microsoft.ReactNative/ReactNativeHost.cpp
+++ b/vnext/Microsoft.ReactNative/ReactNativeHost.cpp
@@ -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 {
diff --git a/vnext/Microsoft.ReactNative/ReactRootView.idl b/vnext/Microsoft.ReactNative/ReactRootView.idl
index 3e3b31120a3..8e572f8464a 100644
--- a/vnext/Microsoft.ReactNative/ReactRootView.idl
+++ b/vnext/Microsoft.ReactNative/ReactRootView.idl
@@ -3,12 +3,13 @@
import "IJSValueWriter.idl";
import "ReactNativeHost.idl";
+#include "../include/NamespaceRedirect.h"
namespace Microsoft.ReactNative {
[default_interface]
[webhosthidden]
- runtimeclass ReactRootView : Windows.UI.Xaml.Controls.Grid {
+ runtimeclass ReactRootView : XAML_NAMESPACE.Controls.Grid {
ReactRootView();
ReactNativeHost ReactNativeHost { get; set; };
diff --git a/vnext/Microsoft.ReactNative/RedBox.cpp b/vnext/Microsoft.ReactNative/RedBox.cpp
index d71808072cf..90279a135e7 100644
--- a/vnext/Microsoft.ReactNative/RedBox.cpp
+++ b/vnext/Microsoft.ReactNative/RedBox.cpp
@@ -2,22 +2,16 @@
// Licensed under the MIT License.
#include "pch.h"
#include "RedBox.h"
+#include
#include
#include
#include
#include
-#include
-#include
-#include
-#include
-#include
#include
-
-#include
#include
+#include "CppWinRTIncludes.h"
#include "Unicode.h"
-namespace xaml = winrt::Windows::UI::Xaml;
using namespace winrt::Windows::Foundation;
namespace Mso::React {
diff --git a/vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp b/vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp
index 7b73c9bc060..d61d17c6bf1 100644
--- a/vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp
+++ b/vnext/Microsoft.ReactNative/Views/ReactRootControl.cpp
@@ -21,12 +21,6 @@
#include
#include
#include
-#include
-#include
-#include
-#include
-#include
-#include
#include
#include
@@ -104,7 +98,7 @@ std::string ReactRootControl::JSComponentName() const noexcept {
int64_t ReactRootControl::GetActualHeight() const noexcept {
if (auto xamlRootView = m_weakXamlRootView.get()) {
- if (auto element = xamlRootView.as()) {
+ if (auto element = xamlRootView.as()) {
return static_cast(element.ActualHeight());
}
}
@@ -114,7 +108,7 @@ int64_t ReactRootControl::GetActualHeight() const noexcept {
int64_t ReactRootControl::GetActualWidth() const noexcept {
if (auto xamlRootView = m_weakXamlRootView.get()) {
- if (auto element = xamlRootView.as()) {
+ if (auto element = xamlRootView.as()) {
return static_cast(element.ActualWidth());
}
}
@@ -138,9 +132,9 @@ void ReactRootControl::blur(XamlView const &xamlView) noexcept {
EnsureFocusSafeHarbor();
if (m_focusSafeHarbor) {
m_focusSafeHarbor.IsTabStop(true);
- winrt::FocusManager::TryFocusAsync(m_focusSafeHarbor, winrt::FocusState::Pointer);
+ xaml::Input::FocusManager::TryFocusAsync(m_focusSafeHarbor, winrt::FocusState::Pointer);
} else
- winrt::FocusManager::TryFocusAsync(xamlView, winrt::FocusState::Pointer);
+ xaml::Input::FocusManager::TryFocusAsync(xamlView, winrt::FocusState::Pointer);
}
void ReactRootControl::InitRootView(
@@ -292,9 +286,9 @@ void ReactRootControl::ShowInstanceWaiting(Mso::React::IReactInstance & /*reactI
if (m_waitingTextBlock == nullptr) {
m_waitingTextBlock = winrt::TextBlock();
m_greenBoxGrid = winrt::Grid{};
- m_greenBoxGrid.Background(winrt::SolidColorBrush(winrt::ColorHelper::FromArgb(0xff, 0x03, 0x59, 0)));
+ m_greenBoxGrid.Background(xaml::Media::SolidColorBrush(winrt::ColorHelper::FromArgb(0xff, 0x03, 0x59, 0)));
m_greenBoxGrid.Children().Append(m_waitingTextBlock);
- m_greenBoxGrid.VerticalAlignment(winrt::Windows::UI::Xaml::VerticalAlignment::Center);
+ m_greenBoxGrid.VerticalAlignment(xaml::VerticalAlignment::Center);
}
// Add box grid to root view
@@ -306,9 +300,9 @@ void ReactRootControl::ShowInstanceWaiting(Mso::React::IReactInstance & /*reactI
// Format TextBlock
m_waitingTextBlock.TextAlignment(winrt::TextAlignment::Center);
- m_waitingTextBlock.TextWrapping(winrt::TextWrapping::Wrap);
+ m_waitingTextBlock.TextWrapping(xaml::TextWrapping::Wrap);
m_waitingTextBlock.FontFamily(winrt::FontFamily(L"Consolas"));
- m_waitingTextBlock.Foreground(winrt::SolidColorBrush(winrt::Colors::White()));
+ m_waitingTextBlock.Foreground(xaml::Media::SolidColorBrush(winrt::Colors::White()));
winrt::Thickness margin = {10.0f, 10.0f, 10.0f, 10.0f};
m_waitingTextBlock.Margin(margin);
}
@@ -328,9 +322,9 @@ void ReactRootControl::ShowInstanceLoading(Mso::React::IReactInstance & /*reactI
if (m_waitingTextBlock == nullptr) {
m_waitingTextBlock = winrt::TextBlock();
m_greenBoxGrid = winrt::Grid{};
- m_greenBoxGrid.Background(winrt::SolidColorBrush(winrt::ColorHelper::FromArgb(0xff, 0x03, 0x59, 0)));
+ m_greenBoxGrid.Background(xaml::Media::SolidColorBrush(winrt::ColorHelper::FromArgb(0xff, 0x03, 0x59, 0)));
m_greenBoxGrid.Children().Append(m_waitingTextBlock);
- m_greenBoxGrid.VerticalAlignment(winrt::Windows::UI::Xaml::VerticalAlignment::Center);
+ m_greenBoxGrid.VerticalAlignment(xaml::VerticalAlignment::Center);
}
// Add box grid to root view
@@ -342,9 +336,9 @@ void ReactRootControl::ShowInstanceLoading(Mso::React::IReactInstance & /*reactI
// Format TextBlock
m_waitingTextBlock.TextAlignment(winrt::TextAlignment::Center);
- m_waitingTextBlock.TextWrapping(winrt::TextWrapping::Wrap);
+ m_waitingTextBlock.TextWrapping(xaml::TextWrapping::Wrap);
m_waitingTextBlock.FontFamily(winrt::FontFamily(L"Consolas"));
- m_waitingTextBlock.Foreground(winrt::SolidColorBrush(winrt::Colors::White()));
+ m_waitingTextBlock.Foreground(xaml::Media::SolidColorBrush(winrt::Colors::White()));
winrt::Thickness margin = {10.0f, 10.0f, 10.0f, 10.0f};
m_waitingTextBlock.Margin(margin);
}
@@ -365,9 +359,9 @@ void ReactRootControl::PrepareXamlRootView(XamlView const &rootView) noexcept {
// Xaml's default projection in 3D is orthographic (all lines are parallel)
// However React Native's default projection is a one-point perspective.
// Set a default perspective projection on the main control to mimic this.
- auto perspectiveTransform3D = winrt::Windows::UI::Xaml::Media::Media3D::PerspectiveTransform3D();
+ auto perspectiveTransform3D = xaml::Media::Media3D::PerspectiveTransform3D();
perspectiveTransform3D.Depth(850);
- winrt::Windows::UI::Xaml::Media::Media3D::Transform3D t3d(perspectiveTransform3D);
+ xaml::Media::Media3D::Transform3D t3d(perspectiveTransform3D);
newRootView.Transform3D(t3d);
children.Append(newRootView);
m_weakXamlRootView = newRootView.try_as();
@@ -384,7 +378,7 @@ void ReactRootControl::EnsureFocusSafeHarbor() noexcept {
auto panel = rootView.try_as();
VerifyElseCrash(panel.Children().Size() == 1);
- m_focusSafeHarbor = winrt::ContentControl{};
+ m_focusSafeHarbor = xaml::Controls::ContentControl{};
m_focusSafeHarbor.Width(0.0);
m_focusSafeHarbor.IsTabStop(false);
panel.Children().InsertAt(0, m_focusSafeHarbor);
@@ -404,9 +398,10 @@ void ReactRootControl::InitializeDeveloperMenu() noexcept {
m_coreDispatcherAKARevoker = coreWindow.Dispatcher().AcceleratorKeyActivated(
winrt::auto_revoke, [this](const auto & /*sender*/, const winrt::AcceleratorKeyEventArgs &args) {
if ((args.VirtualKey() == winrt::Windows::System::VirtualKey::D) &&
- KeyboardHelper::IsModifiedKeyPressed(winrt::CoreWindow::GetForCurrentThread(), winrt::VirtualKey::Shift) &&
KeyboardHelper::IsModifiedKeyPressed(
- winrt::CoreWindow::GetForCurrentThread(), winrt::VirtualKey::Control)) {
+ winrt::CoreWindow::GetForCurrentThread(), winrt::Windows::System::VirtualKey::Shift) &&
+ KeyboardHelper::IsModifiedKeyPressed(
+ winrt::CoreWindow::GetForCurrentThread(), winrt::Windows::System::VirtualKey::Control)) {
if (!IsDeveloperMenuShowing()) {
ShowDeveloperMenu();
}
@@ -629,45 +624,45 @@ void ReactRootControl::AttachBackHandlers(XamlView const &rootView) noexcept {
// In addition to handling the BackRequested event, UWP suggests that we listen for other user inputs that should
// trigger back navigation that don't fire that event:
// https://docs.microsoft.com/en-us/windows/uwp/design/basics/navigation-history-and-backwards-navigation
- auto rootElement(rootView.try_as());
+ auto rootElement(rootView.try_as());
if (rootElement == nullptr) {
assert(false);
return;
}
// Handle keyboard "back" button press
- winrt::KeyboardAccelerator goBack{};
- goBack.Key(winrt::VirtualKey::GoBack);
- goBack.Invoked(
- [weakThis](
- winrt::KeyboardAccelerator const & /*sender*/, winrt::KeyboardAcceleratorInvokedEventArgs const &args) {
- if (auto self = weakThis.lock()) {
- args.Handled(self->OnBackRequested());
- }
- });
+ xaml::Input::KeyboardAccelerator goBack{};
+ goBack.Key(winrt::Windows::System::VirtualKey::GoBack);
+ goBack.Invoked([weakThis](
+ xaml::Input::KeyboardAccelerator const & /*sender*/,
+ xaml::Input::KeyboardAcceleratorInvokedEventArgs const &args) {
+ if (auto self = weakThis.lock()) {
+ args.Handled(self->OnBackRequested());
+ }
+ });
rootElement.KeyboardAccelerators().Append(goBack);
// Handle Alt+Left keyboard shortcut
- winrt::KeyboardAccelerator altLeft{};
- altLeft.Key(winrt::VirtualKey::Left);
- altLeft.Invoked(
- [weakThis](
- winrt::KeyboardAccelerator const & /*sender*/, winrt::KeyboardAcceleratorInvokedEventArgs const &args) {
- if (auto self = weakThis.lock()) {
- args.Handled(self->OnBackRequested());
- }
- });
+ xaml::Input::KeyboardAccelerator altLeft{};
+ altLeft.Key(winrt::Windows::System::VirtualKey::Left);
+ altLeft.Invoked([weakThis](
+ xaml::Input::KeyboardAccelerator const & /*sender*/,
+ xaml::Input::KeyboardAcceleratorInvokedEventArgs const &args) {
+ if (auto self = weakThis.lock()) {
+ args.Handled(self->OnBackRequested());
+ }
+ });
rootElement.KeyboardAccelerators().Append(altLeft);
- altLeft.Modifiers(winrt::VirtualKeyModifiers::Menu);
+ altLeft.Modifiers(winrt::Windows::System::VirtualKeyModifiers::Menu);
// Hide keyboard accelerator tooltips
- rootElement.KeyboardAcceleratorPlacementMode(winrt::KeyboardAcceleratorPlacementMode::Hidden);
+ rootElement.KeyboardAcceleratorPlacementMode(xaml::Input::KeyboardAcceleratorPlacementMode::Hidden);
}
void ReactRootControl::RemoveBackHandlers() noexcept {
m_backRequestedRevoker.revoke();
if (auto rootView = m_weakRootView.get()) {
- if (auto element = rootView.try_as()) {
+ if (auto element = rootView.try_as()) {
element.KeyboardAccelerators().Clear();
}
}
diff --git a/vnext/Microsoft.ReactNative/Views/ReactRootControl.h b/vnext/Microsoft.ReactNative/Views/ReactRootControl.h
index 26bb5948cc2..85d27b74c63 100644
--- a/vnext/Microsoft.ReactNative/Views/ReactRootControl.h
+++ b/vnext/Microsoft.ReactNative/Views/ReactRootControl.h
@@ -6,7 +6,6 @@
#include
#include