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.
Files changed (94) hide show
  1. package/Microsoft.ReactNative/ComponentView.idl +44 -32
  2. package/Microsoft.ReactNative/Composition.Input.idl +3 -0
  3. package/Microsoft.ReactNative/CompositionComponentView.idl +43 -24
  4. package/Microsoft.ReactNative/CompositionSwitcher.idl +3 -0
  5. package/Microsoft.ReactNative/Fabric/AbiEventEmitter.cpp +21 -0
  6. package/Microsoft.ReactNative/Fabric/AbiEventEmitter.h +23 -0
  7. package/Microsoft.ReactNative/Fabric/AbiShadowNode.cpp +7 -0
  8. package/Microsoft.ReactNative/Fabric/AbiShadowNode.h +3 -0
  9. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +334 -65
  10. package/Microsoft.ReactNative/Fabric/ComponentView.h +162 -38
  11. package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +2 -2
  12. package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +3 -0
  13. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +29 -7
  14. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +23 -4
  15. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +44 -13
  16. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +118 -0
  17. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +12 -1
  18. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +147 -119
  19. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +4 -8
  20. package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +1 -0
  21. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +129 -106
  22. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +31 -54
  23. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +133 -0
  24. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +61 -0
  25. package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +9 -8
  26. package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.h +1 -2
  27. package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +20 -6
  28. package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +13 -6
  29. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +1 -4
  30. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +3 -5
  31. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +1 -2
  32. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +1 -6
  33. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +0 -1
  34. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +108 -18
  35. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +33 -5
  36. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +137 -56
  37. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +21 -4
  38. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +45 -10
  39. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +9 -2
  40. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +209 -189
  41. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +2 -5
  42. package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +22 -10
  43. package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +4 -5
  44. package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.cpp +1 -2
  45. package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.h +1 -1
  46. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +115 -168
  47. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +11 -14
  48. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +14 -11
  49. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +4 -4
  50. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -13
  51. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h +0 -3
  52. package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +12 -4
  53. package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +338 -0
  54. package/Microsoft.ReactNative/Fabric/Composition/TooltipService.h +66 -0
  55. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +56 -4
  56. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +7 -0
  57. package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +2 -4
  58. package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.h +1 -2
  59. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +40 -9
  60. package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +4 -0
  61. package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +1 -3
  62. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +25 -1
  63. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +4 -1
  64. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +1 -1
  65. package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +9 -2
  66. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +13 -3
  67. package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +64 -4
  68. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -1
  69. package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +9 -0
  70. package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -0
  71. package/Microsoft.ReactNative/Modules/SampleTurboModule.cpp +104 -0
  72. package/Microsoft.ReactNative/Modules/SampleTurboModule.h +78 -0
  73. package/Microsoft.ReactNative/ReactCoreInjection.h +0 -1
  74. package/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +0 -7
  75. package/Microsoft.ReactNative/ReactHost/MsoReactContext.h +0 -5
  76. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +17 -1
  77. package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.cpp +59 -0
  78. package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.h +23 -0
  79. package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +179 -0
  80. package/Microsoft.ReactNative/ReactNativeAppBuilder.h +35 -0
  81. package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +69 -0
  82. package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -0
  83. package/Microsoft.ReactNative/ReactNativeWin32App.cpp +82 -0
  84. package/Microsoft.ReactNative/ReactNativeWin32App.h +38 -0
  85. package/Microsoft.ReactNative/Timer.idl +1 -1
  86. package/Microsoft.ReactNative/packages.lock.json +0 -10
  87. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  88. package/PropertySheets/WinUI.props +1 -1
  89. package/Shared/Shared.vcxitems +43 -0
  90. package/Shared/Shared.vcxitems.filters +3 -0
  91. package/Shared/TurboModuleManager.cpp +0 -3
  92. package/just-task.js +1 -1
  93. package/package.json +3 -3
  94. package/templates/cpp-app/windows/MyApp/MyApp.cpp +1 -0
@@ -12,11 +12,14 @@
12
12
  #include <react/renderer/core/LayoutMetrics.h>
13
13
 
14
14
  #include <Fabric/Composition/Theme.h>
15
+ #include <uiautomationcore.h>
15
16
  #include <winrt/Microsoft.ReactNative.Composition.Input.h>
16
17
  #include <winrt/Microsoft.ReactNative.h>
17
18
 
18
19
  #include "ComponentView.g.h"
19
- #include "CreateComponentViewArgs.g.h"
20
+ #include "LayoutMetricsChangedArgs.g.h"
21
+ #include "MountChildComponentViewArgs.g.h"
22
+ #include "UnmountChildComponentViewArgs.g.h"
20
23
 
21
24
  namespace winrt::Microsoft::ReactNative::Composition::implementation {
22
25
  struct RootComponentView;
@@ -41,25 +44,41 @@ struct BringIntoViewOptions {
41
44
  float VerticalOffset{0};
42
45
  };
43
46
 
44
- struct CreateComponentViewArgs : public CreateComponentViewArgsT<CreateComponentViewArgs> {
45
- CreateComponentViewArgs(const winrt::Microsoft::ReactNative::IReactContext &reactContext, facebook::react::Tag tag);
47
+ struct LayoutMetricsChangedArgs : public LayoutMetricsChangedArgsT<LayoutMetricsChangedArgs> {
48
+ LayoutMetricsChangedArgs(const LayoutMetrics &newLayoutMetrics, const LayoutMetrics &oldLayoutMetrics);
46
49
 
47
- facebook::react::Tag Tag() const noexcept;
50
+ LayoutMetrics OldLayoutMetrics() const noexcept;
51
+ LayoutMetrics NewLayoutMetrics() const noexcept;
48
52
 
49
- winrt::Microsoft::ReactNative::IReactContext ReactContext() const noexcept;
53
+ private:
54
+ LayoutMetrics m_old;
55
+ LayoutMetrics m_new;
56
+ };
57
+
58
+ struct MountChildComponentViewArgs : public MountChildComponentViewArgsT<MountChildComponentViewArgs> {
59
+ MountChildComponentViewArgs(const winrt::Microsoft::ReactNative::ComponentView &child, uint32_t index);
60
+
61
+ winrt::Microsoft::ReactNative::ComponentView Child() const noexcept;
62
+ uint32_t Index() const noexcept;
50
63
 
51
64
  private:
52
- const facebook::react::Tag m_tag;
53
- const winrt::Microsoft::ReactNative::IReactContext m_reactContext;
65
+ winrt::Microsoft::ReactNative::ComponentView m_child;
66
+ uint32_t m_index;
54
67
  };
55
68
 
56
- struct ComponentView : public ComponentViewT<ComponentView> {
57
- ComponentView(winrt::Microsoft::ReactNative::CreateComponentViewArgs const &args);
69
+ struct UnmountChildComponentViewArgs : public UnmountChildComponentViewArgsT<UnmountChildComponentViewArgs> {
70
+ UnmountChildComponentViewArgs(const winrt::Microsoft::ReactNative::ComponentView &child, uint32_t index);
58
71
 
59
- ComponentView(
60
- facebook::react::Tag tag,
61
- winrt::Microsoft::ReactNative::ReactContext const &reactContext,
62
- bool customComponent);
72
+ winrt::Microsoft::ReactNative::ComponentView Child() const noexcept;
73
+ uint32_t Index() const noexcept;
74
+
75
+ private:
76
+ winrt::Microsoft::ReactNative::ComponentView m_child;
77
+ uint32_t m_index;
78
+ };
79
+
80
+ struct ComponentView : public ComponentViewT<ComponentView> {
81
+ ComponentView(facebook::react::Tag tag, winrt::Microsoft::ReactNative::ReactContext const &reactContext);
63
82
 
64
83
  virtual std::vector<facebook::react::ComponentDescriptorProvider> supplementalComponentDescriptorProviders() noexcept;
65
84
  virtual void updateProps(
@@ -74,7 +93,8 @@ struct ComponentView : public ComponentViewT<ComponentView> {
74
93
  facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept;
75
94
  virtual void prepareForRecycle() noexcept;
76
95
  virtual facebook::react::Props::Shared props() noexcept;
77
- virtual winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *rootComponentView() noexcept;
96
+ virtual winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *rootComponentView()
97
+ const noexcept;
78
98
  virtual void parent(const winrt::Microsoft::ReactNative::ComponentView &parent) noexcept;
79
99
  virtual winrt::Microsoft::ReactNative::ComponentView Parent() const noexcept;
80
100
  virtual winrt::IVectorView<winrt::Microsoft::ReactNative::ComponentView> Children() const noexcept;
@@ -91,7 +111,20 @@ struct ComponentView : public ComponentViewT<ComponentView> {
91
111
  virtual void onGettingFocus(const winrt::Microsoft::ReactNative::GettingFocusEventArgs &args) noexcept;
92
112
  virtual void onLostFocus(const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept;
93
113
  virtual void onGotFocus(const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept;
114
+ void MarkAsCustomComponent() noexcept;
115
+ virtual void onMounted() noexcept;
116
+ virtual void onUnmounted() noexcept;
117
+ void onDestroying() noexcept;
94
118
 
119
+ winrt::event_token Destroying(
120
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView> const &handler) noexcept;
121
+ void Destroying(winrt::event_token const &token) noexcept;
122
+ winrt::event_token Mounted(
123
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView> const &handler) noexcept;
124
+ void Mounted(winrt::event_token const &token) noexcept;
125
+ winrt::event_token Unmounted(
126
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView> const &handler) noexcept;
127
+ void Unmounted(winrt::event_token const &token) noexcept;
95
128
  winrt::event_token LosingFocus(
96
129
  winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::LosingFocusEventArgs> const
97
130
  &handler) noexcept;
@@ -108,6 +141,52 @@ struct ComponentView : public ComponentViewT<ComponentView> {
108
141
  winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs> const
109
142
  &handler) noexcept;
110
143
  void GotFocus(winrt::event_token const &token) noexcept;
144
+ winrt::event_token LayoutMetricsChanged(
145
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::LayoutMetricsChangedArgs> const
146
+ &handler) noexcept;
147
+ void LayoutMetricsChanged(winrt::event_token const &token) noexcept;
148
+
149
+ winrt::event_token KeyDown(
150
+ winrt::Windows::Foundation::EventHandler<
151
+ winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs> const &handler) noexcept;
152
+ void KeyDown(winrt::event_token const &token) noexcept;
153
+ winrt::event_token KeyUp(
154
+ winrt::Windows::Foundation::EventHandler<
155
+ winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs> const &handler) noexcept;
156
+ void KeyUp(winrt::event_token const &token) noexcept;
157
+ winrt::event_token CharacterReceived(
158
+ winrt::Windows::Foundation::EventHandler<
159
+ winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs> const &handler) noexcept;
160
+ void CharacterReceived(winrt::event_token const &token) noexcept;
161
+ winrt::event_token PointerPressed(
162
+ winrt::Windows::Foundation::EventHandler<
163
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept;
164
+ void PointerPressed(winrt::event_token const &token) noexcept;
165
+ winrt::event_token PointerReleased(
166
+ winrt::Windows::Foundation::EventHandler<
167
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept;
168
+ void PointerReleased(winrt::event_token const &token) noexcept;
169
+ winrt::event_token PointerMoved(
170
+ winrt::Windows::Foundation::EventHandler<
171
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept;
172
+ void PointerMoved(winrt::event_token const &token) noexcept;
173
+ winrt::event_token PointerWheelChanged(
174
+ winrt::Windows::Foundation::EventHandler<
175
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept;
176
+ void PointerWheelChanged(winrt::event_token const &token) noexcept;
177
+ winrt::event_token PointerEntered(
178
+ winrt::Windows::Foundation::EventHandler<
179
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept;
180
+ void PointerEntered(winrt::event_token const &token) noexcept;
181
+ winrt::event_token PointerExited(
182
+ winrt::Windows::Foundation::EventHandler<
183
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept;
184
+ void PointerExited(winrt::event_token const &token) noexcept;
185
+ winrt::event_token PointerCaptureLost(
186
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView> const &handler) noexcept;
187
+ void PointerCaptureLost(winrt::event_token const &token) noexcept;
188
+
189
+ LayoutMetrics LayoutMetrics() const noexcept;
111
190
 
112
191
  bool TryFocus() noexcept;
113
192
 
@@ -123,29 +202,37 @@ struct ComponentView : public ComponentViewT<ComponentView> {
123
202
  virtual std::optional<std::string> getAcccessiblityValue() noexcept;
124
203
  virtual void setAcccessiblityValue(std::string &&value) noexcept;
125
204
  virtual bool getAcccessiblityIsReadOnly() noexcept;
205
+ virtual ToggleState getToggleState() noexcept;
206
+ virtual void Toggle() noexcept;
126
207
  winrt::Microsoft::ReactNative::IReactContext ReactContext() const noexcept;
127
208
 
128
209
  // Notify up the tree to bring the rect into view by scrolling as needed
129
210
  virtual void StartBringIntoView(BringIntoViewOptions &&args) noexcept;
130
211
 
212
+ // Eventually PopupContentLink and similar APIs will remove the need for this.
213
+ virtual HWND GetHwndForParenting() noexcept;
214
+
131
215
  virtual const winrt::Microsoft::ReactNative::IComponentProps userProps(
132
216
  facebook::react::Props::Shared const &props) noexcept;
133
217
 
134
- // Publicaly overridable APIs
218
+ void UserData(const winrt::IInspectable &userData) noexcept;
219
+ winrt::IInspectable UserData() const noexcept;
220
+
221
+ void CustomCommandHandler(const HandleCommandDelegate &handler) noexcept;
222
+ void UpdatePropsHandler(const UpdatePropsDelegate &handler) noexcept;
223
+ void UpdateStateHandler(const UpdateStateDelegate &handler) noexcept;
224
+ void UpdateEventEmitterHandler(const UpdateEventEmitterDelegate &handler) noexcept;
225
+ void MountChildComponentViewHandler(const MountChildComponentViewDelegate &handler) noexcept;
226
+ void UnmountChildComponentViewHandler(const UnmountChildComponentViewDelegate &handler) noexcept;
227
+ void FinalizeUpdateHandler(const UpdateFinalizerDelegate &handler) noexcept;
228
+
135
229
  virtual void MountChildComponentView(
136
230
  const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
137
231
  uint32_t index) noexcept;
138
232
  virtual void UnmountChildComponentView(
139
233
  const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
140
234
  uint32_t index) noexcept;
141
- virtual void HandleCommand(
142
- winrt::hstring commandName,
143
- const winrt::Microsoft::ReactNative::IJSValueReader &args) noexcept;
144
- virtual void UpdateProps(
145
- const winrt::Microsoft::ReactNative::IComponentProps &props,
146
- const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept;
147
- virtual void UpdateState(const winrt::Microsoft::ReactNative::IComponentState &state) noexcept;
148
- virtual void UpdateLayoutMetrics(const LayoutMetrics &metrics, const LayoutMetrics &oldMetrics) noexcept;
235
+ virtual void HandleCommand(const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept;
149
236
  virtual void FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask updateMask) noexcept;
150
237
  virtual void OnPointerEntered(
151
238
  const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept;
@@ -160,25 +247,68 @@ struct ComponentView : public ComponentViewT<ComponentView> {
160
247
  virtual void OnPointerWheelChanged(
161
248
  const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept;
162
249
  virtual void OnPointerCaptureLost() noexcept;
163
- virtual void OnKeyDown(
164
- const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
165
- const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept;
166
- virtual void OnKeyUp(
167
- const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
168
- const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept;
250
+ virtual void OnKeyDown(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept;
251
+ virtual void OnKeyUp(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept;
169
252
  virtual void OnCharacterReceived(
170
- const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
171
253
  const winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs &args) noexcept;
172
254
 
173
255
  protected:
174
- const bool m_customComponent; // Is a user custom component, and so needs to call external override functions
256
+ bool m_customComponent : 1 {false}; // Is a user custom component, and so needs to call external override functions
257
+ bool m_mounted : 1 {false};
175
258
  const facebook::react::Tag m_tag;
176
- winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *m_rootView{nullptr};
259
+ winrt::IInspectable m_userData;
260
+ mutable winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *m_rootView{nullptr};
177
261
  mutable winrt::Microsoft::ReactNative::Composition::implementation::Theme *m_theme{nullptr};
178
262
  const winrt::Microsoft::ReactNative::ReactContext m_reactContext;
179
263
  winrt::Microsoft::ReactNative::ComponentView m_parent{nullptr};
264
+ facebook::react::LayoutMetrics m_layoutMetrics;
180
265
  winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::ReactNative::ComponentView> m_children{
181
266
  winrt::single_threaded_vector<winrt::Microsoft::ReactNative::ComponentView>()};
267
+
268
+ UpdatePropsDelegate m_updatePropsDelegate{nullptr};
269
+ UpdateStateDelegate m_updateStateDelegate{nullptr};
270
+ HandleCommandDelegate m_customCommandHandler{nullptr};
271
+ UpdateFinalizerDelegate m_finalizeUpdateHandler{nullptr};
272
+ MountChildComponentViewDelegate m_mountChildComponentViewHandler{nullptr};
273
+ UnmountChildComponentViewDelegate m_unmountChildComponentViewHandler{nullptr};
274
+ UpdateEventEmitterDelegate m_updateEventEmitterHandler{nullptr};
275
+
276
+ winrt::event<
277
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs>>
278
+ m_keyDownEvent;
279
+ winrt::event<
280
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs>>
281
+ m_keyUpEvent;
282
+ winrt::event<winrt::Windows::Foundation::EventHandler<
283
+ winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs>>
284
+ m_characterReceivedEvent;
285
+ winrt::event<winrt::Windows::Foundation::EventHandler<
286
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs>>
287
+ m_pointerPressedEvent;
288
+ winrt::event<winrt::Windows::Foundation::EventHandler<
289
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs>>
290
+ m_pointerReleasedEvent;
291
+ winrt::event<winrt::Windows::Foundation::EventHandler<
292
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs>>
293
+ m_pointerMovedEvent;
294
+ winrt::event<winrt::Windows::Foundation::EventHandler<
295
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs>>
296
+ m_pointerWheelChangedEvent;
297
+ winrt::event<winrt::Windows::Foundation::EventHandler<
298
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs>>
299
+ m_pointerEnteredEvent;
300
+ winrt::event<winrt::Windows::Foundation::EventHandler<
301
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs>>
302
+ m_pointerExitedEvent;
303
+ winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView>>
304
+ m_pointerCaptureLostEvent;
305
+
306
+ winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::LayoutMetricsChangedArgs>>
307
+ m_layoutMetricsChangedEvent;
308
+ winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView>>
309
+ m_destroyingEvent;
310
+ winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView>> m_mountedEvent;
311
+ winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView>> m_unmountedEvent;
182
312
  winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::LosingFocusEventArgs>>
183
313
  m_losingFocusEvent;
184
314
  winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::GettingFocusEventArgs>>
@@ -199,9 +329,3 @@ bool walkTree(
199
329
  Mso::Functor<bool(const winrt::Microsoft::ReactNative::ComponentView &)> &fn) noexcept;
200
330
 
201
331
  } // namespace winrt::Microsoft::ReactNative::implementation
202
-
203
- namespace winrt::Microsoft::ReactNative::factory_implementation {
204
-
205
- struct ComponentView : ComponentViewT<ComponentView, implementation::ComponentView> {};
206
-
207
- } // namespace winrt::Microsoft::ReactNative::factory_implementation
@@ -29,8 +29,7 @@ ActivityIndicatorComponentView::ActivityIndicatorComponentView(
29
29
  compContext,
30
30
  tag,
31
31
  reactContext,
32
- ComponentViewFeatures::Default,
33
- false) {}
32
+ ComponentViewFeatures::Default) {}
34
33
 
35
34
  void ActivityIndicatorComponentView::MountChildComponentView(
36
35
  const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
@@ -83,6 +82,7 @@ void ActivityIndicatorComponentView::FinalizeUpdates(
83
82
  } else {
84
83
  m_ActivityIndicatorVisual.Size(radiusLarge * m_layoutMetrics.pointScaleFactor);
85
84
  }
85
+ base_type::FinalizeUpdates(updateMask);
86
86
  }
87
87
 
88
88
  void ActivityIndicatorComponentView::updateState(
@@ -124,5 +124,8 @@ void ComponentViewRegistry::enqueueComponentViewWithComponentHandle(
124
124
  ->prepareForRecycle();
125
125
 
126
126
  m_registry.erase(tag);
127
+
128
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(componentViewDescriptor.view)
129
+ ->onDestroying();
127
130
  }
128
131
  } // namespace Microsoft::ReactNative
@@ -10,8 +10,13 @@
10
10
 
11
11
  namespace winrt::Microsoft::ReactNative::Composition::Input::implementation {
12
12
 
13
- KeyRoutedEventArgs::KeyRoutedEventArgs(facebook::react::Tag tag, uint32_t msg, uint64_t wParam, int64_t lParam)
14
- : m_tag(tag) {
13
+ KeyRoutedEventArgs::KeyRoutedEventArgs(
14
+ facebook::react::Tag tag,
15
+ uint32_t msg,
16
+ uint64_t wParam,
17
+ int64_t lParam,
18
+ const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source)
19
+ : m_tag(tag), m_source(source) {
15
20
  bool fUp = (msg == WM_KEYUP || msg == WM_SYSKEYUP);
16
21
  bool fSysKey = (msg == WM_SYSKEYUP || msg == WM_SYSKEYDOWN);
17
22
 
@@ -35,8 +40,11 @@ KeyRoutedEventArgs::KeyRoutedEventArgs(facebook::react::Tag tag, uint32_t msg, u
35
40
  }
36
41
 
37
42
  #ifdef USE_WINUI3
38
- KeyRoutedEventArgs::KeyRoutedEventArgs(facebook::react::Tag tag, winrt::Microsoft::UI::Input::KeyEventArgs const &args)
39
- : m_tag(tag) {
43
+ KeyRoutedEventArgs::KeyRoutedEventArgs(
44
+ facebook::react::Tag tag,
45
+ winrt::Microsoft::UI::Input::KeyEventArgs const &args,
46
+ const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source)
47
+ : m_tag(tag), m_source(source) {
40
48
  auto keyStatus = args.KeyStatus();
41
49
  m_keyStatus.RepeatCount = keyStatus.RepeatCount;
42
50
  m_keyStatus.ScanCode = keyStatus.ScanCode;
@@ -75,12 +83,17 @@ winrt::Microsoft::UI::Input::PhysicalKeyStatus KeyRoutedEventArgs::KeyStatus() n
75
83
  winrt::Windows::System::VirtualKey KeyRoutedEventArgs::OriginalKey() noexcept {
76
84
  return m_key;
77
85
  }
86
+ winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource KeyRoutedEventArgs::KeyboardSource() const noexcept {
87
+ return m_source;
88
+ }
78
89
 
79
90
  CharacterReceivedRoutedEventArgs::CharacterReceivedRoutedEventArgs(
80
91
  facebook::react::Tag tag,
81
92
  uint32_t msg,
82
93
  uint64_t wParam,
83
- int64_t lParam) {
94
+ int64_t lParam,
95
+ const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source)
96
+ : m_source(source) {
84
97
  m_keycode = static_cast<int32_t>(wParam);
85
98
  m_keyStatus.RepeatCount = (lParam & 0x0000FFFF); // bits 0-15
86
99
  m_keyStatus.ScanCode = (lParam & 0x00FF0000) >> 16; // bits 16-23
@@ -93,8 +106,9 @@ CharacterReceivedRoutedEventArgs::CharacterReceivedRoutedEventArgs(
93
106
  #ifdef USE_WINUI3
94
107
  CharacterReceivedRoutedEventArgs::CharacterReceivedRoutedEventArgs(
95
108
  facebook::react::Tag tag,
96
- winrt::Microsoft::UI::Input::CharacterReceivedEventArgs const &args)
97
- : m_tag(tag) {
109
+ winrt::Microsoft::UI::Input::CharacterReceivedEventArgs const &args,
110
+ const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source)
111
+ : m_tag(tag), m_source(source) {
98
112
  auto keyStatus = args.KeyStatus();
99
113
  m_keyStatus.RepeatCount = keyStatus.RepeatCount;
100
114
  m_keyStatus.ScanCode = keyStatus.ScanCode;
@@ -121,6 +135,10 @@ int32_t CharacterReceivedRoutedEventArgs::KeyCode() noexcept {
121
135
  winrt::Microsoft::UI::Input::PhysicalKeyStatus CharacterReceivedRoutedEventArgs::KeyStatus() noexcept {
122
136
  return m_keyStatus;
123
137
  }
138
+ winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource CharacterReceivedRoutedEventArgs::KeyboardSource()
139
+ const noexcept {
140
+ return m_source;
141
+ }
124
142
 
125
143
  Pointer::Pointer(winrt::Microsoft::ReactNative::Composition::Input::PointerDeviceType type, uint32_t id)
126
144
  : m_type(type), m_id(id) {}
@@ -619,6 +637,10 @@ bool PointerPoint::IsPointerMessage(uint32_t message) const noexcept {
619
637
  return (message >= WM_POINTERFIRST && message <= WM_POINTERLAST);
620
638
  }
621
639
 
640
+ winrt::Microsoft::UI::Input::PointerPoint PointerPoint::Inner() const noexcept {
641
+ return m_sysPointerPoint;
642
+ }
643
+
622
644
  PointerRoutedEventArgs::PointerRoutedEventArgs(
623
645
  const winrt::Microsoft::ReactNative::ReactContext &context,
624
646
  facebook::react::Tag tag,
@@ -21,9 +21,17 @@ struct KeyRoutedEventArgs : winrt::implements<
21
21
  KeyRoutedEventArgs,
22
22
  winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs,
23
23
  winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs> {
24
- KeyRoutedEventArgs(facebook::react::Tag tag, uint32_t msg, uint64_t wParam, int64_t lParam);
24
+ KeyRoutedEventArgs(
25
+ facebook::react::Tag tag,
26
+ uint32_t msg,
27
+ uint64_t wParam,
28
+ int64_t lParam,
29
+ const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source);
25
30
  #ifdef USE_WINUI3
26
- KeyRoutedEventArgs(facebook::react::Tag tag, winrt::Microsoft::UI::Input::KeyEventArgs const &args);
31
+ KeyRoutedEventArgs(
32
+ facebook::react::Tag tag,
33
+ winrt::Microsoft::UI::Input::KeyEventArgs const &args,
34
+ const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source);
27
35
  #endif
28
36
 
29
37
  int32_t OriginalSource() noexcept;
@@ -33,12 +41,14 @@ struct KeyRoutedEventArgs : winrt::implements<
33
41
  winrt::Windows::System::VirtualKey Key() noexcept;
34
42
  winrt::Microsoft::UI::Input::PhysicalKeyStatus KeyStatus() noexcept;
35
43
  winrt::Windows::System::VirtualKey OriginalKey() noexcept;
44
+ winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource KeyboardSource() const noexcept;
36
45
 
37
46
  private:
38
47
  facebook::react::Tag m_tag{-1};
39
48
  bool m_handled{false};
40
49
  winrt::Windows::System::VirtualKey m_key;
41
50
  winrt::Microsoft::UI::Input::PhysicalKeyStatus m_keyStatus;
51
+ const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource m_source;
42
52
  };
43
53
 
44
54
  struct CharacterReceivedRoutedEventArgs
@@ -46,11 +56,17 @@ struct CharacterReceivedRoutedEventArgs
46
56
  CharacterReceivedRoutedEventArgs,
47
57
  winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs,
48
58
  winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs> {
49
- CharacterReceivedRoutedEventArgs(facebook::react::Tag tag, uint32_t msg, uint64_t wParam, int64_t lParam);
59
+ CharacterReceivedRoutedEventArgs(
60
+ facebook::react::Tag tag,
61
+ uint32_t msg,
62
+ uint64_t wParam,
63
+ int64_t lParam,
64
+ const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source);
50
65
  #ifdef USE_WINUI3
51
66
  CharacterReceivedRoutedEventArgs(
52
67
  facebook::react::Tag tag,
53
- winrt::Microsoft::UI::Input::CharacterReceivedEventArgs const &args);
68
+ winrt::Microsoft::UI::Input::CharacterReceivedEventArgs const &args,
69
+ const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source);
54
70
  #endif
55
71
 
56
72
  int32_t OriginalSource() noexcept;
@@ -58,12 +74,14 @@ struct CharacterReceivedRoutedEventArgs
58
74
  void Handled(bool value) noexcept;
59
75
  int32_t KeyCode() noexcept;
60
76
  winrt::Microsoft::UI::Input::PhysicalKeyStatus KeyStatus() noexcept;
77
+ winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource KeyboardSource() const noexcept;
61
78
 
62
79
  private:
63
80
  facebook::react::Tag m_tag{-1};
64
81
  bool m_handled{false};
65
82
  int32_t m_keycode;
66
83
  winrt::Microsoft::UI::Input::PhysicalKeyStatus m_keyStatus;
84
+ const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource m_source;
67
85
  };
68
86
 
69
87
  struct Pointer : PointerT<Pointer> {
@@ -180,6 +198,7 @@ struct PointerPoint : PointerPointT<PointerPoint> {
180
198
  uint64_t Timestamp() const noexcept;
181
199
  winrt::Microsoft::ReactNative::Composition::Input::PointerPoint GetOffsetPoint(
182
200
  const winrt::Windows::Foundation::Point &offset) const noexcept;
201
+ winrt::Microsoft::UI::Input::PointerPoint Inner() const noexcept;
183
202
 
184
203
  private:
185
204
  bool IsPointerMessage(uint32_t message) const noexcept;
@@ -12,6 +12,7 @@
12
12
 
13
13
  #include <Windows.Graphics.Interop.h>
14
14
  #include <windows.ui.composition.interop.h>
15
+ #include <winrt/Microsoft.ReactNative.Composition.Input.h>
15
16
  #include <winrt/Windows.Graphics.DirectX.Direct3D11.h>
16
17
  #include <winrt/Windows.UI.Composition.h>
17
18
  #include <winrt/Windows.UI.Composition.interactions.h>
@@ -744,14 +745,9 @@ struct CompScrollerVisual : winrt::implements<
744
745
  m_interactionTracker.MaxScale(1.0);
745
746
 
746
747
  m_visualInteractionSource = TTypeRedirects::VisualInteractionSource::Create(m_visual);
747
-
748
- m_visualInteractionSource.PositionXSourceMode(TTypeRedirects::InteractionSourceMode::EnabledWithInertia);
749
- m_visualInteractionSource.PositionYSourceMode(TTypeRedirects::InteractionSourceMode::EnabledWithInertia);
750
748
  m_visualInteractionSource.ScaleSourceMode(TTypeRedirects::InteractionSourceMode::Disabled);
751
-
752
- m_visualInteractionSource.ManipulationRedirectionMode(
753
- TTypeRedirects::VisualInteractionSourceRedirectionMode::CapableTouchpadAndPointerWheel);
754
749
  m_interactionTracker.InteractionSources().Add(m_visualInteractionSource);
750
+ UpdateInteractionModes();
755
751
 
756
752
  auto positionExpression = compositor.CreateExpressionAnimation(L"-tracker.Position");
757
753
  positionExpression.SetReferenceParameter(L"tracker", m_interactionTracker);
@@ -762,6 +758,44 @@ struct CompScrollerVisual : winrt::implements<
762
758
  return m_visual;
763
759
  }
764
760
 
761
+ void OnPointerPressed(
762
+ const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept {
763
+ if constexpr (std::is_same_v<TTypeRedirects, MicrosoftTypeRedirects>) {
764
+ auto pointerDeviceType = args.Pointer().PointerDeviceType();
765
+ if (pointerDeviceType == winrt::Microsoft::ReactNative::Composition::Input::PointerDeviceType::Touch) {
766
+ m_visualInteractionSource.TryRedirectForManipulation(args.GetCurrentPoint(args.OriginalSource()).Inner());
767
+ }
768
+ }
769
+ }
770
+
771
+ bool Horizontal() const noexcept {
772
+ return m_horizontal;
773
+ }
774
+
775
+ void Horizontal(bool value) noexcept {
776
+ m_horizontal = value;
777
+
778
+ UpdateInteractionModes();
779
+ }
780
+
781
+ void UpdateInteractionModes() noexcept {
782
+ if (m_isScrollEnabled) {
783
+ m_visualInteractionSource.PositionXSourceMode(
784
+ m_horizontal ? TTypeRedirects::InteractionSourceMode::EnabledWithInertia
785
+ : TTypeRedirects::InteractionSourceMode::Disabled);
786
+ m_visualInteractionSource.PositionYSourceMode(
787
+ m_horizontal ? TTypeRedirects::InteractionSourceMode::Disabled
788
+ : TTypeRedirects::InteractionSourceMode::EnabledWithInertia);
789
+ m_visualInteractionSource.ManipulationRedirectionMode(
790
+ TTypeRedirects::VisualInteractionSourceRedirectionMode::CapableTouchpadAndPointerWheel);
791
+ } else {
792
+ m_visualInteractionSource.PositionXSourceMode(TTypeRedirects::InteractionSourceMode::Disabled);
793
+ m_visualInteractionSource.PositionYSourceMode(TTypeRedirects::InteractionSourceMode::Disabled);
794
+ m_visualInteractionSource.ManipulationRedirectionMode(
795
+ TTypeRedirects::VisualInteractionSourceRedirectionMode::Off);
796
+ }
797
+ }
798
+
765
799
  void InsertAt(
766
800
  const winrt::Microsoft::ReactNative::Composition::Experimental::IVisual &visual,
767
801
  uint32_t index) noexcept {
@@ -796,13 +830,8 @@ struct CompScrollerVisual : winrt::implements<
796
830
  }
797
831
 
798
832
  void ScrollEnabled(bool isScrollEnabled) noexcept {
799
- if (isScrollEnabled) {
800
- m_visualInteractionSource.ManipulationRedirectionMode(
801
- TTypeRedirects::VisualInteractionSourceRedirectionMode::CapableTouchpadAndPointerWheel);
802
- } else {
803
- m_visualInteractionSource.ManipulationRedirectionMode(
804
- TTypeRedirects::VisualInteractionSourceRedirectionMode::Off);
805
- }
833
+ m_isScrollEnabled = isScrollEnabled;
834
+ UpdateInteractionModes();
806
835
  }
807
836
 
808
837
  void Opacity(float opacity) noexcept {
@@ -970,6 +999,8 @@ struct CompScrollerVisual : winrt::implements<
970
999
  0});
971
1000
  }
972
1001
 
1002
+ bool m_isScrollEnabled{true};
1003
+ bool m_horizontal{false};
973
1004
  bool m_inertia{false};
974
1005
  bool m_custom{false};
975
1006
  winrt::Windows::Foundation::Numerics::float3 m_targetPosition;