react-native-windows 0.74.20 → 0.74.22
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/ComponentView.idl +44 -32
- package/Microsoft.ReactNative/Composition.Input.idl +3 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +43 -24
- package/Microsoft.ReactNative/CompositionSwitcher.idl +3 -0
- package/Microsoft.ReactNative/Fabric/AbiEventEmitter.cpp +21 -0
- package/Microsoft.ReactNative/Fabric/AbiEventEmitter.h +23 -0
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.cpp +7 -0
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.h +3 -0
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +334 -65
- package/Microsoft.ReactNative/Fabric/ComponentView.h +162 -38
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +29 -7
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +23 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +44 -13
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +118 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +12 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +147 -119
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +4 -8
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +129 -106
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +31 -54
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +133 -0
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +61 -0
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +9 -8
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +20 -6
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +13 -6
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +1 -4
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +3 -5
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +1 -6
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +108 -18
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +33 -5
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +137 -56
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +21 -4
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +45 -10
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +9 -2
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +209 -189
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +2 -5
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +22 -10
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +4 -5
- package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.cpp +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +115 -168
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +11 -14
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +14 -11
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +4 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -13
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h +0 -3
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +12 -4
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +338 -0
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.h +66 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +56 -4
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +7 -0
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +2 -4
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +40 -9
- package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +4 -0
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +1 -3
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +25 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +4 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +1 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +9 -2
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +13 -3
- package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +64 -4
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +9 -0
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -0
- package/Microsoft.ReactNative/Modules/SampleTurboModule.cpp +104 -0
- package/Microsoft.ReactNative/Modules/SampleTurboModule.h +78 -0
- package/Microsoft.ReactNative/ReactCoreInjection.h +0 -1
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +0 -7
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.h +0 -5
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +17 -1
- package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.cpp +59 -0
- package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.h +23 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +179 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.h +35 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +69 -0
- package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -0
- package/Microsoft.ReactNative/ReactNativeWin32App.cpp +82 -0
- package/Microsoft.ReactNative/ReactNativeWin32App.h +38 -0
- package/Microsoft.ReactNative/Timer.idl +1 -1
- package/Microsoft.ReactNative/packages.lock.json +0 -10
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/WinUI.props +1 -1
- package/Shared/Shared.vcxitems +43 -0
- package/Shared/Shared.vcxitems.filters +3 -0
- package/Shared/TurboModuleManager.cpp +0 -3
- package/just-task.js +1 -1
- package/package.json +3 -3
- package/templates/cpp-app/windows/MyApp/MyApp.cpp +1 -0
|
@@ -8,9 +8,13 @@
|
|
|
8
8
|
#include "DynamicReader.h"
|
|
9
9
|
|
|
10
10
|
#include "ComponentView.g.cpp"
|
|
11
|
-
#include "
|
|
11
|
+
#include "LayoutMetricsChangedArgs.g.cpp"
|
|
12
|
+
#include "MountChildComponentViewArgs.g.cpp"
|
|
13
|
+
#include "UnmountChildComponentViewArgs.g.cpp"
|
|
12
14
|
#include <Fabric/Composition/RootComponentView.h>
|
|
15
|
+
#include "AbiEventEmitter.h"
|
|
13
16
|
#include "AbiShadowNode.h"
|
|
17
|
+
#include "ReactCoreInjection.h"
|
|
14
18
|
|
|
15
19
|
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
16
20
|
struct RootComponentView;
|
|
@@ -18,31 +22,29 @@ struct RootComponentView;
|
|
|
18
22
|
|
|
19
23
|
namespace winrt::Microsoft::ReactNative::implementation {
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
facebook::react::Tag tag)
|
|
24
|
-
: m_tag(tag), m_reactContext(reactContext){};
|
|
25
|
+
ComponentView::ComponentView(facebook::react::Tag tag, winrt::Microsoft::ReactNative::ReactContext const &reactContext)
|
|
26
|
+
: m_tag(tag), m_reactContext(reactContext) {}
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
void ComponentView::MarkAsCustomComponent() noexcept {
|
|
29
|
+
m_customComponent = true;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
std::vector<facebook::react::ComponentDescriptorProvider>
|
|
33
|
+
ComponentView::supplementalComponentDescriptorProviders() noexcept {
|
|
34
|
+
return {};
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
ComponentView::
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
: m_tag(tag), m_reactContext(reactContext), m_customComponent(customComponent) {}
|
|
37
|
+
winrt::event_token ComponentView::Destroying(
|
|
38
|
+
winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView> const &handler) noexcept {
|
|
39
|
+
return m_destroyingEvent.add(handler);
|
|
40
|
+
}
|
|
39
41
|
|
|
40
|
-
ComponentView::
|
|
41
|
-
|
|
42
|
+
void ComponentView::Destroying(winrt::event_token const &token) noexcept {
|
|
43
|
+
m_destroyingEvent.remove(token);
|
|
44
|
+
}
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return {};
|
|
46
|
+
void ComponentView::onDestroying() noexcept {
|
|
47
|
+
m_destroyingEvent(*this, *this);
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
void ComponentView::MountChildComponentView(
|
|
@@ -50,73 +52,199 @@ void ComponentView::MountChildComponentView(
|
|
|
50
52
|
uint32_t index) noexcept {
|
|
51
53
|
m_children.InsertAt(index, childComponentView);
|
|
52
54
|
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(childComponentView)->parent(*this);
|
|
55
|
+
if (m_mountChildComponentViewHandler) {
|
|
56
|
+
m_mountChildComponentViewHandler(*this, winrt::make<MountChildComponentViewArgs>(childComponentView, index));
|
|
57
|
+
}
|
|
58
|
+
if (m_mounted) {
|
|
59
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(childComponentView)->onMounted();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
void ComponentView::MountChildComponentViewHandler(const MountChildComponentViewDelegate &handler) noexcept {
|
|
64
|
+
m_mountChildComponentViewHandler = handler;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
void ComponentView::onMounted() noexcept {
|
|
68
|
+
assert(!m_mounted);
|
|
69
|
+
m_mounted = true;
|
|
70
|
+
for (auto it = m_children.begin(); it != m_children.end(); ++it) {
|
|
71
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(*it)->onMounted();
|
|
72
|
+
}
|
|
73
|
+
m_mountedEvent(*this, *this);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
winrt::event_token ComponentView::Mounted(
|
|
77
|
+
winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView> const &handler) noexcept {
|
|
78
|
+
return m_mountedEvent.add(handler);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
void ComponentView::Mounted(winrt::event_token const &token) noexcept {
|
|
82
|
+
m_mountedEvent.remove(token);
|
|
53
83
|
}
|
|
54
84
|
|
|
55
85
|
void ComponentView::UnmountChildComponentView(
|
|
56
86
|
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
57
87
|
uint32_t index) noexcept {
|
|
88
|
+
if (m_mountChildComponentViewHandler) {
|
|
89
|
+
m_mountChildComponentViewHandler(*this, winrt::make<MountChildComponentViewArgs>(childComponentView, index));
|
|
90
|
+
}
|
|
58
91
|
m_children.RemoveAt(index);
|
|
59
92
|
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(childComponentView)->parent(nullptr);
|
|
93
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(childComponentView)->onUnmounted();
|
|
94
|
+
}
|
|
95
|
+
void ComponentView::UnmountChildComponentViewHandler(const UnmountChildComponentViewDelegate &handler) noexcept {
|
|
96
|
+
m_unmountChildComponentViewHandler = handler;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
void ComponentView::onUnmounted() noexcept {
|
|
100
|
+
if (!m_mounted)
|
|
101
|
+
return;
|
|
102
|
+
m_mounted = false;
|
|
103
|
+
for (auto it = m_children.begin(); it != m_children.end(); ++it) {
|
|
104
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(*it)->onUnmounted();
|
|
105
|
+
}
|
|
106
|
+
m_unmountedEvent(*this, *this);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
winrt::event_token ComponentView::Unmounted(
|
|
110
|
+
winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView> const &handler) noexcept {
|
|
111
|
+
return m_unmountedEvent.add(handler);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
void ComponentView::Unmounted(winrt::event_token const &token) noexcept {
|
|
115
|
+
m_unmountedEvent.remove(token);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
MountChildComponentViewArgs::MountChildComponentViewArgs(
|
|
119
|
+
const winrt::Microsoft::ReactNative::ComponentView &child,
|
|
120
|
+
uint32_t index)
|
|
121
|
+
: m_child(child), m_index(index) {}
|
|
122
|
+
|
|
123
|
+
winrt::Microsoft::ReactNative::ComponentView MountChildComponentViewArgs::Child() const noexcept {
|
|
124
|
+
return m_child;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
uint32_t MountChildComponentViewArgs::Index() const noexcept {
|
|
128
|
+
return m_index;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
UnmountChildComponentViewArgs::UnmountChildComponentViewArgs(
|
|
132
|
+
const winrt::Microsoft::ReactNative::ComponentView &child,
|
|
133
|
+
uint32_t index)
|
|
134
|
+
: m_child(child), m_index(index) {}
|
|
135
|
+
|
|
136
|
+
winrt::Microsoft::ReactNative::ComponentView UnmountChildComponentViewArgs::Child() const noexcept {
|
|
137
|
+
return m_child;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
uint32_t UnmountChildComponentViewArgs::Index() const noexcept {
|
|
141
|
+
return m_index;
|
|
60
142
|
}
|
|
61
143
|
|
|
62
144
|
void ComponentView::updateProps(
|
|
63
145
|
facebook::react::Props::Shared const &props,
|
|
64
146
|
facebook::react::Props::Shared const &oldProps) noexcept {
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
winrt::Microsoft::ReactNative::ComponentView outer(*this);
|
|
68
|
-
outer.UpdateProps(userProps(props), oldProps ? userProps(oldProps) : nullptr);
|
|
147
|
+
if (m_updatePropsDelegate) {
|
|
148
|
+
m_updatePropsDelegate(*this, userProps(props), oldProps ? userProps(oldProps) : nullptr);
|
|
69
149
|
}
|
|
70
150
|
}
|
|
71
151
|
|
|
72
|
-
void ComponentView::
|
|
73
|
-
|
|
74
|
-
|
|
152
|
+
void ComponentView::UpdatePropsHandler(const UpdatePropsDelegate &handler) noexcept {
|
|
153
|
+
m_updatePropsDelegate = handler;
|
|
154
|
+
}
|
|
75
155
|
|
|
76
156
|
const winrt::Microsoft::ReactNative::IComponentProps ComponentView::userProps(
|
|
77
157
|
facebook::react::Props::Shared const &props) noexcept {
|
|
78
|
-
assert(m_customComponent);
|
|
79
158
|
const auto &abiProps =
|
|
80
159
|
*std::static_pointer_cast<const winrt::Microsoft::ReactNative::implementation::AbiProps>(props);
|
|
81
160
|
return abiProps.UserProps();
|
|
82
161
|
}
|
|
83
162
|
|
|
84
|
-
void ComponentView::updateEventEmitter(facebook::react::EventEmitter::Shared const &eventEmitter) noexcept {
|
|
163
|
+
void ComponentView::updateEventEmitter(facebook::react::EventEmitter::Shared const &eventEmitter) noexcept {
|
|
164
|
+
if (m_updateEventEmitterHandler) {
|
|
165
|
+
m_updateEventEmitterHandler(*this, winrt::make<EventEmitter>(eventEmitter));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
void ComponentView::UpdateEventEmitterHandler(const UpdateEventEmitterDelegate &handler) noexcept {
|
|
170
|
+
m_updateEventEmitterHandler = handler;
|
|
171
|
+
}
|
|
85
172
|
|
|
86
173
|
void ComponentView::updateState(
|
|
87
174
|
facebook::react::State::Shared const &state,
|
|
88
175
|
facebook::react::State::Shared const &oldState) noexcept {
|
|
89
176
|
// Avoid new-ing up a new AbiComponentState on every state change if we are not a custom component
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
winrt::Microsoft::ReactNative::ComponentView outer(*this);
|
|
93
|
-
outer.UpdateState(winrt::make<::Microsoft::ReactNative::AbiComponentState>(state));
|
|
177
|
+
if (m_updateStateDelegate) {
|
|
178
|
+
m_updateStateDelegate(*this, winrt::make<::Microsoft::ReactNative::AbiComponentState>(state));
|
|
94
179
|
}
|
|
95
180
|
}
|
|
96
181
|
|
|
97
|
-
void ComponentView::
|
|
182
|
+
void ComponentView::UpdateStateHandler(const UpdateStateDelegate &handler) noexcept {
|
|
183
|
+
m_updateStateDelegate = handler;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
LayoutMetricsChangedArgs::LayoutMetricsChangedArgs(
|
|
187
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &newLayoutMetrics,
|
|
188
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &oldLayoutMetrics)
|
|
189
|
+
: m_old(oldLayoutMetrics), m_new(newLayoutMetrics) {}
|
|
190
|
+
|
|
191
|
+
LayoutMetrics LayoutMetricsChangedArgs::OldLayoutMetrics() const noexcept {
|
|
192
|
+
return m_old;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
LayoutMetrics LayoutMetricsChangedArgs::NewLayoutMetrics() const noexcept {
|
|
196
|
+
return m_new;
|
|
197
|
+
}
|
|
98
198
|
|
|
99
199
|
void ComponentView::updateLayoutMetrics(
|
|
100
200
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
101
201
|
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
202
|
+
winrt::Microsoft::ReactNative::LayoutMetrics oldMetrics{
|
|
203
|
+
{oldLayoutMetrics.frame.origin.x,
|
|
204
|
+
oldLayoutMetrics.frame.origin.y,
|
|
205
|
+
oldLayoutMetrics.frame.size.width,
|
|
206
|
+
oldLayoutMetrics.frame.size.height},
|
|
207
|
+
oldLayoutMetrics.pointScaleFactor};
|
|
208
|
+
winrt::Microsoft::ReactNative::LayoutMetrics newMetrics{
|
|
209
|
+
{layoutMetrics.frame.origin.x,
|
|
210
|
+
layoutMetrics.frame.origin.y,
|
|
211
|
+
layoutMetrics.frame.size.width,
|
|
212
|
+
layoutMetrics.frame.size.height},
|
|
213
|
+
layoutMetrics.pointScaleFactor};
|
|
214
|
+
|
|
215
|
+
m_layoutMetrics = layoutMetrics;
|
|
216
|
+
|
|
217
|
+
m_layoutMetricsChangedEvent(*this, winrt::make<LayoutMetricsChangedArgs>(newMetrics, oldMetrics));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
LayoutMetrics ComponentView::LayoutMetrics() const noexcept {
|
|
221
|
+
return {
|
|
222
|
+
{m_layoutMetrics.frame.origin.x,
|
|
223
|
+
m_layoutMetrics.frame.origin.y,
|
|
224
|
+
m_layoutMetrics.frame.size.width,
|
|
225
|
+
m_layoutMetrics.frame.size.height},
|
|
226
|
+
m_layoutMetrics.pointScaleFactor};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
winrt::event_token ComponentView::LayoutMetricsChanged(
|
|
230
|
+
winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::LayoutMetricsChangedArgs> const
|
|
231
|
+
&handler) noexcept {
|
|
232
|
+
return m_layoutMetricsChangedEvent.add(handler);
|
|
115
233
|
}
|
|
116
234
|
|
|
117
|
-
void ComponentView::
|
|
235
|
+
void ComponentView::LayoutMetricsChanged(winrt::event_token const &token) noexcept {
|
|
236
|
+
m_layoutMetricsChangedEvent.remove(token);
|
|
237
|
+
}
|
|
118
238
|
|
|
119
|
-
void ComponentView::
|
|
239
|
+
void ComponentView::FinalizeUpdateHandler(const UpdateFinalizerDelegate &handler) noexcept {
|
|
240
|
+
m_finalizeUpdateHandler = handler;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
void ComponentView::FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask updateMask) noexcept {
|
|
244
|
+
if (m_finalizeUpdateHandler) {
|
|
245
|
+
m_finalizeUpdateHandler(*this, updateMask);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
120
248
|
|
|
121
249
|
void ComponentView::prepareForRecycle() noexcept {}
|
|
122
250
|
|
|
@@ -125,12 +253,29 @@ facebook::react::Props::Shared ComponentView::props() noexcept {
|
|
|
125
253
|
return {};
|
|
126
254
|
}
|
|
127
255
|
|
|
128
|
-
void ComponentView::
|
|
129
|
-
|
|
130
|
-
|
|
256
|
+
void ComponentView::CustomCommandHandler(const HandleCommandDelegate &handler) noexcept {
|
|
257
|
+
m_customCommandHandler = handler;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
void ComponentView::HandleCommand(const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept {
|
|
261
|
+
if (m_customCommandHandler) {
|
|
262
|
+
m_customCommandHandler(*this, args);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
131
265
|
|
|
132
|
-
|
|
133
|
-
|
|
266
|
+
HWND ComponentView::GetHwndForParenting() noexcept {
|
|
267
|
+
if (m_parent) {
|
|
268
|
+
return winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(m_parent)
|
|
269
|
+
->GetHwndForParenting();
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Fallback if we do not know any more specific HWND
|
|
273
|
+
return reinterpret_cast<HWND>(winrt::Microsoft::ReactNative::implementation::ReactCoreInjection::GetTopLevelWindowId(
|
|
274
|
+
m_reactContext.Properties().Handle()));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *ComponentView::rootComponentView()
|
|
278
|
+
const noexcept {
|
|
134
279
|
if (m_rootView)
|
|
135
280
|
return m_rootView;
|
|
136
281
|
|
|
@@ -150,7 +295,7 @@ void ComponentView::parent(const winrt::Microsoft::ReactNative::ComponentView &p
|
|
|
150
295
|
m_parent = parent;
|
|
151
296
|
if (!parent) {
|
|
152
297
|
if (oldRootView && oldRootView->GetFocusedComponent() == *this) {
|
|
153
|
-
oldRootView->TrySetFocusedComponent(oldParent);
|
|
298
|
+
oldRootView->TrySetFocusedComponent(oldParent, winrt::Microsoft::ReactNative::FocusNavigationDirection::None);
|
|
154
299
|
}
|
|
155
300
|
}
|
|
156
301
|
if (parent) {
|
|
@@ -289,20 +434,124 @@ void ComponentView::GotFocus(winrt::event_token const &token) noexcept {
|
|
|
289
434
|
|
|
290
435
|
bool ComponentView::TryFocus() noexcept {
|
|
291
436
|
if (auto root = rootComponentView()) {
|
|
292
|
-
return root->TrySetFocusedComponent(*get_strong());
|
|
437
|
+
return root->TrySetFocusedComponent(*get_strong(), winrt::Microsoft::ReactNative::FocusNavigationDirection::None);
|
|
293
438
|
}
|
|
294
439
|
|
|
295
440
|
return false;
|
|
296
441
|
}
|
|
297
442
|
|
|
443
|
+
winrt::event_token ComponentView::KeyDown(
|
|
444
|
+
winrt::Windows::Foundation::EventHandler<
|
|
445
|
+
winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs> const &handler) noexcept {
|
|
446
|
+
return m_keyDownEvent.add(handler);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
void ComponentView::KeyDown(winrt::event_token const &token) noexcept {
|
|
450
|
+
m_keyDownEvent.remove(token);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
winrt::event_token ComponentView::KeyUp(
|
|
454
|
+
winrt::Windows::Foundation::EventHandler<
|
|
455
|
+
winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs> const &handler) noexcept {
|
|
456
|
+
return m_keyUpEvent.add(handler);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
void ComponentView::KeyUp(winrt::event_token const &token) noexcept {
|
|
460
|
+
m_keyUpEvent.remove(token);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
winrt::event_token ComponentView::CharacterReceived(
|
|
464
|
+
winrt::Windows::Foundation::EventHandler<
|
|
465
|
+
winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs> const &handler) noexcept {
|
|
466
|
+
return m_characterReceivedEvent.add(handler);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
void ComponentView::CharacterReceived(winrt::event_token const &token) noexcept {
|
|
470
|
+
m_characterReceivedEvent.remove(token);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
winrt::event_token ComponentView::PointerPressed(
|
|
474
|
+
winrt::Windows::Foundation::EventHandler<
|
|
475
|
+
winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept {
|
|
476
|
+
return m_pointerPressedEvent.add(handler);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
void ComponentView::PointerPressed(winrt::event_token const &token) noexcept {
|
|
480
|
+
m_pointerPressedEvent.remove(token);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
winrt::event_token ComponentView::PointerReleased(
|
|
484
|
+
winrt::Windows::Foundation::EventHandler<
|
|
485
|
+
winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept {
|
|
486
|
+
return m_pointerReleasedEvent.add(handler);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
void ComponentView::PointerReleased(winrt::event_token const &token) noexcept {
|
|
490
|
+
m_pointerReleasedEvent.remove(token);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
winrt::event_token ComponentView::PointerMoved(
|
|
494
|
+
winrt::Windows::Foundation::EventHandler<
|
|
495
|
+
winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept {
|
|
496
|
+
return m_pointerMovedEvent.add(handler);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
void ComponentView::PointerMoved(winrt::event_token const &token) noexcept {
|
|
500
|
+
m_pointerMovedEvent.remove(token);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
winrt::event_token ComponentView::PointerWheelChanged(
|
|
504
|
+
winrt::Windows::Foundation::EventHandler<
|
|
505
|
+
winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept {
|
|
506
|
+
return m_pointerWheelChangedEvent.add(handler);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
void ComponentView::PointerWheelChanged(winrt::event_token const &token) noexcept {
|
|
510
|
+
m_pointerWheelChangedEvent.remove(token);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
winrt::event_token ComponentView::PointerEntered(
|
|
514
|
+
winrt::Windows::Foundation::EventHandler<
|
|
515
|
+
winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept {
|
|
516
|
+
return m_pointerEnteredEvent.add(handler);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
void ComponentView::PointerEntered(winrt::event_token const &token) noexcept {
|
|
520
|
+
m_pointerEnteredEvent.remove(token);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
winrt::event_token ComponentView::PointerExited(
|
|
524
|
+
winrt::Windows::Foundation::EventHandler<
|
|
525
|
+
winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept {
|
|
526
|
+
return m_pointerExitedEvent.add(handler);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
void ComponentView::PointerExited(winrt::event_token const &token) noexcept {
|
|
530
|
+
m_pointerExitedEvent.remove(token);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
winrt::event_token ComponentView::PointerCaptureLost(
|
|
534
|
+
winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView> const &handler) noexcept {
|
|
535
|
+
return m_pointerCaptureLostEvent.add(handler);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
void ComponentView::PointerCaptureLost(winrt::event_token const &token) noexcept {
|
|
539
|
+
m_pointerCaptureLostEvent.remove(token);
|
|
540
|
+
}
|
|
541
|
+
|
|
298
542
|
void ComponentView::OnPointerEntered(
|
|
299
|
-
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept {
|
|
543
|
+
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept {
|
|
544
|
+
m_pointerEnteredEvent(*this, args);
|
|
545
|
+
}
|
|
300
546
|
|
|
301
547
|
void ComponentView::OnPointerExited(
|
|
302
|
-
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept {
|
|
548
|
+
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept {
|
|
549
|
+
m_pointerExitedEvent(*this, args);
|
|
550
|
+
}
|
|
303
551
|
|
|
304
552
|
void ComponentView::OnPointerPressed(
|
|
305
553
|
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept {
|
|
554
|
+
m_pointerPressedEvent(*this, args);
|
|
306
555
|
if (m_parent && !args.Handled()) {
|
|
307
556
|
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(m_parent)->OnPointerPressed(args);
|
|
308
557
|
}
|
|
@@ -310,6 +559,7 @@ void ComponentView::OnPointerPressed(
|
|
|
310
559
|
|
|
311
560
|
void ComponentView::OnPointerReleased(
|
|
312
561
|
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept {
|
|
562
|
+
m_pointerReleasedEvent(*this, args);
|
|
313
563
|
if (m_parent && !args.Handled()) {
|
|
314
564
|
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(m_parent)->OnPointerReleased(args);
|
|
315
565
|
}
|
|
@@ -317,6 +567,7 @@ void ComponentView::OnPointerReleased(
|
|
|
317
567
|
|
|
318
568
|
void ComponentView::OnPointerMoved(
|
|
319
569
|
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept {
|
|
570
|
+
m_pointerMovedEvent(*this, args);
|
|
320
571
|
if (m_parent && !args.Handled()) {
|
|
321
572
|
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(m_parent)->OnPointerMoved(args);
|
|
322
573
|
}
|
|
@@ -324,36 +575,38 @@ void ComponentView::OnPointerMoved(
|
|
|
324
575
|
|
|
325
576
|
void ComponentView::OnPointerWheelChanged(
|
|
326
577
|
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept {
|
|
578
|
+
m_pointerWheelChangedEvent(*this, args);
|
|
327
579
|
if (m_parent && !args.Handled()) {
|
|
328
580
|
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(m_parent)->OnPointerWheelChanged(
|
|
329
581
|
args);
|
|
330
582
|
}
|
|
331
583
|
}
|
|
332
584
|
|
|
333
|
-
void ComponentView::OnPointerCaptureLost() noexcept {
|
|
585
|
+
void ComponentView::OnPointerCaptureLost() noexcept {
|
|
586
|
+
m_pointerCaptureLostEvent(*this, *this);
|
|
587
|
+
}
|
|
334
588
|
|
|
335
589
|
void ComponentView::OnKeyDown(
|
|
336
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
337
590
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept {
|
|
591
|
+
m_keyDownEvent(*this, args);
|
|
338
592
|
if (m_parent && !args.Handled()) {
|
|
339
|
-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(m_parent)->OnKeyDown(
|
|
593
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(m_parent)->OnKeyDown(args);
|
|
340
594
|
}
|
|
341
595
|
}
|
|
342
596
|
|
|
343
597
|
void ComponentView::OnKeyUp(
|
|
344
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
345
598
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept {
|
|
599
|
+
m_keyUpEvent(*this, args);
|
|
346
600
|
if (m_parent && !args.Handled()) {
|
|
347
|
-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(m_parent)->OnKeyUp(
|
|
601
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(m_parent)->OnKeyUp(args);
|
|
348
602
|
}
|
|
349
603
|
}
|
|
350
604
|
|
|
351
605
|
void ComponentView::OnCharacterReceived(
|
|
352
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
353
606
|
const winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs &args) noexcept {
|
|
607
|
+
m_characterReceivedEvent(*this, args);
|
|
354
608
|
if (m_parent && !args.Handled()) {
|
|
355
|
-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(m_parent)->OnCharacterReceived(
|
|
356
|
-
source, args);
|
|
609
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(m_parent)->OnCharacterReceived(args);
|
|
357
610
|
}
|
|
358
611
|
}
|
|
359
612
|
|
|
@@ -373,6 +626,14 @@ facebook::react::Tag ComponentView::Tag() const noexcept {
|
|
|
373
626
|
return m_tag;
|
|
374
627
|
}
|
|
375
628
|
|
|
629
|
+
void ComponentView::UserData(const winrt::IInspectable &userData) noexcept {
|
|
630
|
+
m_userData = userData;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
winrt::IInspectable ComponentView::UserData() const noexcept {
|
|
634
|
+
return m_userData;
|
|
635
|
+
}
|
|
636
|
+
|
|
376
637
|
// By default, hitTests according the pointerEvents prop on the Component.
|
|
377
638
|
// If ignorePointerEvents = true, all Components are treated as valid targets
|
|
378
639
|
facebook::react::Tag ComponentView::hitTest(
|
|
@@ -399,6 +660,14 @@ bool ComponentView::getAcccessiblityIsReadOnly() noexcept {
|
|
|
399
660
|
return false;
|
|
400
661
|
}
|
|
401
662
|
|
|
663
|
+
ToggleState ComponentView::getToggleState() noexcept {
|
|
664
|
+
return ToggleState::ToggleState_Off;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
void ComponentView::Toggle() noexcept {
|
|
668
|
+
assert(false);
|
|
669
|
+
}
|
|
670
|
+
|
|
402
671
|
// Notify up the tree to bring the rect into view by scrolling as needed
|
|
403
672
|
void ComponentView::StartBringIntoView(BringIntoViewOptions &&args) noexcept {
|
|
404
673
|
assert(false);
|