react-native-windows 0.0.0-canary.503 → 0.0.0-canary.504
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Chakra/ChakraHelpers.cpp +1 -1
- package/Chakra/ChakraPlatform.cpp +1 -1
- package/Chakra/ChakraValue.h +1 -1
- package/Microsoft.ReactNative/IReactContext.cpp +17 -0
- package/Microsoft.ReactNative/IReactContext.h +2 -0
- package/Microsoft.ReactNative/IReactContext.idl +27 -0
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +12 -8
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +14 -10
- package/Microsoft.ReactNative/Utils/Helpers.cpp +1 -1
- package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +1 -1
- package/Mso/src/dispatchQueue/looperScheduler.cpp +25 -18
- package/PropertySheets/Generated/PackageVersion.g.props +1 -1
- package/Shared/JSI/ChakraRuntime.cpp +2 -2
- package/package.json +1 -1
package/Chakra/ChakraHelpers.cpp
CHANGED
|
@@ -27,7 +27,7 @@ JsValueRef __stdcall nowHookJNF(
|
|
|
27
27
|
void * /*callbackState*/) {
|
|
28
28
|
assert(argumentCount == 1);
|
|
29
29
|
double now = nowHook != nullptr ? nowHook() : 0;
|
|
30
|
-
JsValueRef value;
|
|
30
|
+
JsValueRef value = nullptr;
|
|
31
31
|
CHAKRA_ASSERTDO(JsDoubleToNumber(now, &value));
|
|
32
32
|
return value;
|
|
33
33
|
}
|
package/Chakra/ChakraValue.h
CHANGED
|
@@ -96,6 +96,23 @@ Windows::Foundation::IInspectable ReactContext::JSRuntime() noexcept {
|
|
|
96
96
|
return m_context->JsiRuntime();
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
LoadingState ReactContext::LoadingState() noexcept {
|
|
100
|
+
switch (m_context->State()) {
|
|
101
|
+
case Mso::React::ReactInstanceState::Loading:
|
|
102
|
+
case Mso::React::ReactInstanceState::WaitingForDebugger:
|
|
103
|
+
return LoadingState::Loading;
|
|
104
|
+
case Mso::React::ReactInstanceState::Loaded:
|
|
105
|
+
return LoadingState::Loaded;
|
|
106
|
+
case Mso::React::ReactInstanceState::HasError:
|
|
107
|
+
return LoadingState::HasError;
|
|
108
|
+
case Mso::React::ReactInstanceState::Unloaded:
|
|
109
|
+
return LoadingState::Unloaded;
|
|
110
|
+
default:
|
|
111
|
+
assert(false);
|
|
112
|
+
return LoadingState::HasError;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
99
116
|
#ifndef CORE_ABI
|
|
100
117
|
// Deprecated: Use XamlUIService directly.
|
|
101
118
|
void ReactContext::DispatchEvent(
|
|
@@ -42,6 +42,8 @@ struct ReactContext : winrt::implements<ReactContext, IReactContext> {
|
|
|
42
42
|
IReactDispatcher UIDispatcher() noexcept;
|
|
43
43
|
IReactDispatcher JSDispatcher() noexcept;
|
|
44
44
|
IInspectable JSRuntime() noexcept;
|
|
45
|
+
LoadingState LoadingState() noexcept;
|
|
46
|
+
|
|
45
47
|
#ifndef CORE_ABI
|
|
46
48
|
void DispatchEvent(
|
|
47
49
|
xaml::FrameworkElement const &view,
|
|
@@ -13,6 +13,29 @@ import "IReactPropertyBag.idl";
|
|
|
13
13
|
|
|
14
14
|
namespace Microsoft.ReactNative
|
|
15
15
|
{
|
|
16
|
+
|
|
17
|
+
DOC_STRING(
|
|
18
|
+
"Used to represent the state of the React Native JavaScript instance")
|
|
19
|
+
enum LoadingState
|
|
20
|
+
{
|
|
21
|
+
DOC_STRING(
|
|
22
|
+
"The instance is loading the JavaScript bundle and initial instance setup. Calls to run JavaScript functions will be queued to run once the instance is fully loaded."
|
|
23
|
+
)
|
|
24
|
+
Loading = 0,
|
|
25
|
+
DOC_STRING(
|
|
26
|
+
"The instance is in a ready state. Calls to run JavaScript functions will be run as soon as they are posted to the JavaScript instance."
|
|
27
|
+
)
|
|
28
|
+
Loaded = 1,
|
|
29
|
+
DOC_STRING(
|
|
30
|
+
"The instance has hit an error. Calls to run JavaScript functions will not be run."
|
|
31
|
+
)
|
|
32
|
+
HasError = 2,
|
|
33
|
+
DOC_STRING(
|
|
34
|
+
"The instance has successfully unloaded. Calls to run JavaScript functions will not be run."
|
|
35
|
+
)
|
|
36
|
+
Unloaded = 3
|
|
37
|
+
};
|
|
38
|
+
|
|
16
39
|
[webhosthidden]
|
|
17
40
|
DOC_STRING("An immutable snapshot of the @ReactInstanceSettings used to create the current React instance.")
|
|
18
41
|
interface IReactSettingsSnapshot
|
|
@@ -167,5 +190,9 @@ namespace Microsoft.ReactNative
|
|
|
167
190
|
"The `paramsArgWriter` is a @JSValueArgWriter delegate that receives @IJSValueWriter to serialize "
|
|
168
191
|
"the event parameters.")
|
|
169
192
|
void EmitJSEvent(String eventEmitterName, String eventName, JSValueArgWriter paramsArgWriter);
|
|
193
|
+
|
|
194
|
+
DOC_STRING(
|
|
195
|
+
"Gets the state of the ReactNative instance.")
|
|
196
|
+
LoadingState LoadingState { get; };
|
|
170
197
|
}
|
|
171
198
|
} // namespace Microsoft.ReactNative
|
|
@@ -905,16 +905,20 @@ void NativeUIManager::DoLayout() {
|
|
|
905
905
|
UpdateExtraLayout(rootTag);
|
|
906
906
|
|
|
907
907
|
ShadowNodeBase &rootShadowNode = static_cast<ShadowNodeBase &>(m_host->GetShadowNodeForTag(rootTag));
|
|
908
|
-
YGNodeRef rootNode = GetYogaNode(rootTag)
|
|
909
|
-
|
|
908
|
+
if (YGNodeRef rootNode = GetYogaNode(rootTag)) {
|
|
909
|
+
auto rootElement = rootShadowNode.GetView().as<xaml::FrameworkElement>();
|
|
910
910
|
|
|
911
|
-
|
|
912
|
-
|
|
911
|
+
float actualWidth = static_cast<float>(rootElement.ActualWidth());
|
|
912
|
+
float actualHeight = static_cast<float>(rootElement.ActualHeight());
|
|
913
913
|
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
914
|
+
// We must always run layout in LTR mode, which might seem unintuitive.
|
|
915
|
+
// We will flip the root of the tree into RTL by forcing the root XAML node's FlowDirection to RightToLeft
|
|
916
|
+
// which will inherit down the XAML tree, allowing all native controls to pick it up.
|
|
917
|
+
YGNodeCalculateLayout(rootNode, actualWidth, actualHeight, YGDirectionLTR);
|
|
918
|
+
} else {
|
|
919
|
+
assert(false);
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
918
922
|
}
|
|
919
923
|
|
|
920
924
|
for (auto &tagToYogaNode : m_tagsToYogaNodes) {
|
|
@@ -126,20 +126,24 @@ class UIManagerModule : public std::enable_shared_from_this<UIManagerModule>, pu
|
|
|
126
126
|
|
|
127
127
|
void createView(int64_t reactTag, std::string viewName, int64_t rootTag, React::JSValueObject &&props) noexcept {
|
|
128
128
|
m_nativeUIManager->ensureInBatch();
|
|
129
|
-
auto viewManager = GetViewManager(viewName)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
if (auto viewManager = GetViewManager(viewName)) {
|
|
130
|
+
auto node = viewManager->createShadow();
|
|
131
|
+
node->m_className = std::move(viewName);
|
|
132
|
+
node->m_tag = reactTag;
|
|
133
|
+
node->m_rootTag = rootTag;
|
|
134
|
+
node->m_viewManager = viewManager;
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
node->createView(props);
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
m_nativeUIManager->CreateView(*node, props);
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
m_nodeRegistry.addNode(shadow_ptr(node), reactTag);
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
node->updateProperties(props);
|
|
143
|
+
} else {
|
|
144
|
+
assert(false);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
143
147
|
}
|
|
144
148
|
|
|
145
149
|
void updateView(int64_t reactTag, std::string viewName, React::JSValueObject &&props) noexcept {
|
|
@@ -31,7 +31,7 @@ namespace Microsoft::ReactNative {
|
|
|
31
31
|
// Instead of deduce view id directly from FrameworkElement.Tag, this do
|
|
32
32
|
// additional check by uimanager.
|
|
33
33
|
ReactId getViewId(const Mso::React::IReactContext &context, xaml::FrameworkElement const &fe) {
|
|
34
|
-
ReactId reactId;
|
|
34
|
+
ReactId reactId{};
|
|
35
35
|
if (auto uiManager = Microsoft::ReactNative::GetNativeUIManager(context).lock()) {
|
|
36
36
|
if (auto peer = uiManager->reactPeerOrContainerFrom(fe)) {
|
|
37
37
|
reactId.isValid = true;
|
|
@@ -240,7 +240,7 @@ TouchEventHandler::ReactPointer TouchEventHandler::CreateReactPointer(
|
|
|
240
240
|
auto point = args.GetCurrentPoint(sourceElement);
|
|
241
241
|
auto props = point.Properties();
|
|
242
242
|
|
|
243
|
-
ReactPointer pointer;
|
|
243
|
+
ReactPointer pointer{};
|
|
244
244
|
pointer.target = tag;
|
|
245
245
|
pointer.identifier = m_touchId++;
|
|
246
246
|
pointer.pointerId = point.PointerId();
|
|
@@ -43,38 +43,45 @@ LooperScheduler::~LooperScheduler() noexcept {
|
|
|
43
43
|
/*static*/ void LooperScheduler::RunLoop(const Mso::WeakPtr<LooperScheduler> &weakSelf) noexcept {
|
|
44
44
|
for (;;) {
|
|
45
45
|
if (auto self = weakSelf.GetStrongPtr()) {
|
|
46
|
-
if (auto queue = self->m_queue.GetStrongPtr()) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
if (auto queue = DispatchQueue{self->m_queue.GetStrongPtr()}) {
|
|
47
|
+
for (;;) {
|
|
48
|
+
DispatchTask task;
|
|
49
|
+
if (!(*GetRawState(queue))->TryDequeTask(task)) {
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
|
|
50
53
|
if (auto &func = self->m_settings.TaskStarting) {
|
|
51
|
-
func(
|
|
54
|
+
func(queue);
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
queue->InvokeTask(std::move(task), std::nullopt);
|
|
57
|
+
(*GetRawState(queue))->InvokeTask(std::move(task), std::nullopt);
|
|
55
58
|
|
|
56
59
|
if (auto &func = self->m_settings.TaskCompleted) {
|
|
57
|
-
func(
|
|
60
|
+
func(queue);
|
|
58
61
|
}
|
|
59
62
|
}
|
|
63
|
+
}
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
if (self->m_isShutdown) {
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
if (auto &func = self->m_settings.IdleWaitStarting) {
|
|
70
|
+
if (auto queue = DispatchQueue{self->m_queue.GetStrongPtr()}) {
|
|
71
|
+
func(queue);
|
|
67
72
|
}
|
|
73
|
+
}
|
|
68
74
|
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
self->m_wakeUpEvent.Wait();
|
|
76
|
+
self->m_wakeUpEvent.Reset();
|
|
71
77
|
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
if (auto &func = self->m_settings.IdleWaitCompleted) {
|
|
79
|
+
if (auto queue = DispatchQueue{self->m_queue.GetStrongPtr()}) {
|
|
80
|
+
func(queue);
|
|
74
81
|
}
|
|
75
|
-
|
|
76
|
-
continue;
|
|
77
82
|
}
|
|
83
|
+
|
|
84
|
+
continue;
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
break;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.0.0-canary.
|
|
13
|
+
<ReactNativeWindowsVersion>0.0.0-canary.504</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>0</ReactNativeWindowsMinor>
|
|
16
16
|
<ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
|
|
@@ -116,7 +116,7 @@ void ChakraRuntime::PromiseContinuation(JsValueRef funcRef) noexcept {
|
|
|
116
116
|
if (runtimeArgs().jsQueue) {
|
|
117
117
|
JsAddRef(funcRef, nullptr);
|
|
118
118
|
runtimeArgs().jsQueue->runOnQueue([this, funcRef]() {
|
|
119
|
-
JsValueRef undefinedValue;
|
|
119
|
+
JsValueRef undefinedValue = nullptr;
|
|
120
120
|
JsGetUndefinedValue(&undefinedValue);
|
|
121
121
|
ChakraVerifyJsErrorElseThrow(JsCallFunction(funcRef, &undefinedValue, 1, nullptr));
|
|
122
122
|
JsRelease(funcRef, nullptr);
|
|
@@ -976,7 +976,7 @@ ChakraRuntime::JsiValueViewArgs::JsiValueViewArgs(JsValueRef *args, size_t argCo
|
|
|
976
976
|
JsiValueView::StoreType *const pointerStore =
|
|
977
977
|
m_heapPointerStore ? m_heapPointerStore.get() : m_stackPointerStore.data();
|
|
978
978
|
facebook::jsi::Value *const jsiArgs = m_heapArgs ? m_heapArgs.get() : m_stackArgs.data();
|
|
979
|
-
for (
|
|
979
|
+
for (size_t i = 0; i < m_size; ++i) {
|
|
980
980
|
jsiArgs[i] = JsiValueView::InitValue(args[i], std::addressof(pointerStore[i]));
|
|
981
981
|
}
|
|
982
982
|
}
|