react-native-windows 0.74.20 → 0.74.21

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