react-native-windows 0.82.1 → 0.82.3
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/Microsoft.ReactNative/Base/CxxReactIncludes.h +11 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +52 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +70 -49
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +4 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.cpp +7 -2
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -1
- package/Microsoft.ReactNative/Pch/pch.h +2 -0
- package/Microsoft.ReactNative/ReactHost/CrashManager.cpp +5 -0
- package/Microsoft.ReactNative/ReactHost/ReactNativeHeaders.h +1 -0
- package/PropertySheets/External/Microsoft.ReactNative.Composition.CppLib.props +10 -0
- package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppLib.props +10 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/ReactCommon/ReactCommon.vcxproj +10 -10
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/Instance.cpp +379 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +47 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSIndexedRAMBundle.cpp +143 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/MethodCall.cpp +98 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ModuleRegistry.cpp +254 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +9 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/RAMBundleRegistry.cpp +91 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ReactMarker.cpp +147 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSIExecutor.cpp +622 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSINativeModules.cpp +121 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/webperformance/NativePerformance.cpp +409 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/BaseViewProps.cpp +628 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventDispatcher.cpp +79 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventQueueProcessor.cpp +138 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManager.cpp +732 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +687 -0
- package/Shared/Shared.vcxitems +9 -9
- package/package.json +1 -1
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +2 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#if _MSC_VER
|
|
9
|
+
#pragma warning(push)
|
|
10
|
+
#pragma warning(disable : 4996) // deprecated APIs
|
|
11
|
+
#endif
|
|
12
|
+
#include <cxxreact/JSExecutor.h>
|
|
13
|
+
#include <logger/react_native_log.h>
|
|
14
|
+
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
|
15
|
+
#include "EventEmitter.h"
|
|
16
|
+
#include "EventLogger.h"
|
|
17
|
+
#include "EventQueue.h"
|
|
18
|
+
#include "ShadowNodeFamily.h"
|
|
19
|
+
|
|
20
|
+
namespace facebook::react {
|
|
21
|
+
|
|
22
|
+
EventQueueProcessor::EventQueueProcessor(
|
|
23
|
+
EventPipe eventPipe,
|
|
24
|
+
EventPipeConclusion eventPipeConclusion,
|
|
25
|
+
StatePipe statePipe,
|
|
26
|
+
std::weak_ptr<EventLogger> eventLogger)
|
|
27
|
+
: eventPipe_(std::move(eventPipe)),
|
|
28
|
+
eventPipeConclusion_(std::move(eventPipeConclusion)),
|
|
29
|
+
statePipe_(std::move(statePipe)),
|
|
30
|
+
eventLogger_(std::move(eventLogger)) {}
|
|
31
|
+
|
|
32
|
+
void EventQueueProcessor::flushEvents(
|
|
33
|
+
jsi::Runtime& runtime,
|
|
34
|
+
std::vector<RawEvent>&& events) const {
|
|
35
|
+
{
|
|
36
|
+
std::scoped_lock lock(EventEmitter::DispatchMutex());
|
|
37
|
+
|
|
38
|
+
for (const auto& event : events) {
|
|
39
|
+
if (event.eventTarget) {
|
|
40
|
+
event.eventTarget->retain(runtime);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
for (const auto& event : events) {
|
|
46
|
+
auto reactPriority = ReactEventPriority::Default;
|
|
47
|
+
|
|
48
|
+
if (ReactNativeFeatureFlags::
|
|
49
|
+
fixMappingOfEventPrioritiesBetweenFabricAndReact()) {
|
|
50
|
+
reactPriority = [&]() {
|
|
51
|
+
switch (event.category) {
|
|
52
|
+
case RawEvent::Category::Discrete:
|
|
53
|
+
return ReactEventPriority::Discrete;
|
|
54
|
+
case RawEvent::Category::ContinuousStart:
|
|
55
|
+
hasContinuousEventStarted_ = true;
|
|
56
|
+
return ReactEventPriority::Discrete;
|
|
57
|
+
case RawEvent::Category::ContinuousEnd:
|
|
58
|
+
hasContinuousEventStarted_ = false;
|
|
59
|
+
return ReactEventPriority::Discrete;
|
|
60
|
+
case RawEvent::Category::Continuous:
|
|
61
|
+
return ReactEventPriority::Continuous;
|
|
62
|
+
case RawEvent::Category::Idle:
|
|
63
|
+
return ReactEventPriority::Idle;
|
|
64
|
+
case RawEvent::Category::Unspecified:
|
|
65
|
+
return hasContinuousEventStarted_ ? ReactEventPriority::Continuous
|
|
66
|
+
: ReactEventPriority::Default;
|
|
67
|
+
}
|
|
68
|
+
return ReactEventPriority::Default;
|
|
69
|
+
}();
|
|
70
|
+
} else {
|
|
71
|
+
if (event.category == RawEvent::Category::ContinuousEnd) {
|
|
72
|
+
hasContinuousEventStarted_ = false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
reactPriority = hasContinuousEventStarted_ ? ReactEventPriority::Default
|
|
76
|
+
: ReactEventPriority::Discrete;
|
|
77
|
+
|
|
78
|
+
if (event.category == RawEvent::Category::Continuous) {
|
|
79
|
+
reactPriority = ReactEventPriority::Default;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (event.category == RawEvent::Category::Discrete) {
|
|
83
|
+
reactPriority = ReactEventPriority::Discrete;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
auto eventLogger = eventLogger_.lock();
|
|
88
|
+
if (eventLogger != nullptr) {
|
|
89
|
+
eventLogger->onEventProcessingStart(event.loggingTag);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (event.eventPayload == nullptr) {
|
|
93
|
+
react_native_log_error(
|
|
94
|
+
"EventQueueProcessor: Unexpected null event payload");
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
eventPipe_(
|
|
99
|
+
runtime,
|
|
100
|
+
event.eventTarget.get(),
|
|
101
|
+
event.type,
|
|
102
|
+
reactPriority,
|
|
103
|
+
*event.eventPayload);
|
|
104
|
+
|
|
105
|
+
if (eventLogger != nullptr) {
|
|
106
|
+
eventLogger->onEventProcessingEnd(event.loggingTag);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (event.category == RawEvent::Category::ContinuousStart) {
|
|
110
|
+
hasContinuousEventStarted_ = true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// We only run the "Conclusion" once per event group when batched.
|
|
115
|
+
eventPipeConclusion_(runtime);
|
|
116
|
+
|
|
117
|
+
// No need to lock `EventEmitter::DispatchMutex()` here.
|
|
118
|
+
// The mutex protects from a situation when the `instanceHandle` can be
|
|
119
|
+
// deallocated during accessing, but that's impossible at this point because
|
|
120
|
+
// we have a strong pointer to it.
|
|
121
|
+
for (const auto& event : events) {
|
|
122
|
+
if (event.eventTarget) {
|
|
123
|
+
event.eventTarget->release(runtime);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
void EventQueueProcessor::flushStateUpdates(
|
|
129
|
+
std::vector<StateUpdate>&& states) const {
|
|
130
|
+
for (const auto& stateUpdate : states) {
|
|
131
|
+
statePipe_(stateUpdate);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
} // namespace facebook::react
|
|
136
|
+
#if _MSC_VER
|
|
137
|
+
#pragma warning(pop)
|
|
138
|
+
#endif
|