react-native-windows 0.75.0 → 0.75.2

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 (77) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/Microsoft.ReactNative/ComponentView.idl +33 -32
  3. package/Microsoft.ReactNative/Composition.Input.idl +2 -0
  4. package/Microsoft.ReactNative/CompositionComponentView.idl +43 -24
  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 +318 -59
  10. package/Microsoft.ReactNative/Fabric/ComponentView.h +155 -33
  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 +25 -7
  14. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +22 -4
  15. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +43 -0
  16. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +6 -1
  17. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +147 -119
  18. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +4 -8
  19. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +97 -101
  20. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +28 -52
  21. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +133 -0
  22. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +61 -0
  23. package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +1 -2
  24. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +1 -4
  25. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +1 -2
  26. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +1 -6
  27. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +0 -1
  28. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +108 -18
  29. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +33 -5
  30. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +57 -1
  31. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +6 -0
  32. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +8 -2
  33. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +2 -0
  34. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +195 -182
  35. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +1 -3
  36. package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +16 -4
  37. package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +3 -3
  38. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +12 -17
  39. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +4 -11
  40. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +19 -0
  41. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +4 -0
  42. package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +1 -2
  43. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +10 -7
  44. package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +1 -3
  45. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +20 -1
  46. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +3 -0
  47. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +13 -3
  48. package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +57 -4
  49. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +2 -0
  50. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +74 -67
  51. package/Microsoft.ReactNative/ReactNativeIsland.idl +3 -0
  52. package/PropertySheets/External/Microsoft.ReactNative.Composition.Package.props +1 -0
  53. package/PropertySheets/External/Microsoft.ReactNative.Composition.Package.targets +4 -0
  54. package/PropertySheets/External/Microsoft.ReactNative.Cpp.PackageReferences.props +14 -4
  55. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  56. package/PropertySheets/WinUI.props +1 -1
  57. package/Scripts/Microsoft.ReactNative.VersionCheck.targets +2 -0
  58. package/Shared/DevSettings.h +3 -0
  59. package/Shared/OInstance.cpp +6 -2
  60. package/Shared/Shared.vcxitems +7 -0
  61. package/just-task.js +1 -1
  62. package/package.json +13 -13
  63. package/template/cpp-app/proj/MyApp.sln +19 -19
  64. package/template/cpp-lib/proj/MyLib.sln +19 -19
  65. package/template/cs-app/proj/MyApp.sln +21 -21
  66. package/template/cs-lib/proj/MyLib.sln +21 -21
  67. package/templates/cpp-app/NuGet_Config +13 -0
  68. package/templates/cpp-app/template.config.js +6 -1
  69. package/templates/cpp-app/windows/ExperimentalFeatures.props +1 -0
  70. package/templates/cpp-app/windows/MyApp.sln +29 -19
  71. package/templates/cpp-lib/NuGet_Config +13 -0
  72. package/templates/cpp-lib/example/NuGet_Config +6 -0
  73. package/templates/cpp-lib/template.config.js +6 -1
  74. package/templates/cpp-lib/windows/ExperimentalFeatures.props +1 -0
  75. package/templates/cpp-lib/windows/MyLib.sln +35 -25
  76. package/templates/old/generateWrapper.js +3 -3
  77. package/templates/templateUtils.js +3 -1
@@ -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(
@@ -91,7 +110,20 @@ struct ComponentView : public ComponentViewT<ComponentView> {
91
110
  virtual void onGettingFocus(const winrt::Microsoft::ReactNative::GettingFocusEventArgs &args) noexcept;
92
111
  virtual void onLostFocus(const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept;
93
112
  virtual void onGotFocus(const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept;
113
+ void MarkAsCustomComponent() noexcept;
114
+ virtual void onMounted() noexcept;
115
+ virtual void onUnmounted() noexcept;
116
+ void onDestroying() noexcept;
94
117
 
118
+ winrt::event_token Destroying(
119
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView> const &handler) noexcept;
120
+ void Destroying(winrt::event_token const &token) noexcept;
121
+ winrt::event_token Mounted(
122
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView> const &handler) noexcept;
123
+ void Mounted(winrt::event_token const &token) noexcept;
124
+ winrt::event_token Unmounted(
125
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView> const &handler) noexcept;
126
+ void Unmounted(winrt::event_token const &token) noexcept;
95
127
  winrt::event_token LosingFocus(
96
128
  winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::LosingFocusEventArgs> const
97
129
  &handler) noexcept;
@@ -108,6 +140,52 @@ struct ComponentView : public ComponentViewT<ComponentView> {
108
140
  winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs> const
109
141
  &handler) noexcept;
110
142
  void GotFocus(winrt::event_token const &token) noexcept;
143
+ winrt::event_token LayoutMetricsChanged(
144
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::LayoutMetricsChangedArgs> const
145
+ &handler) noexcept;
146
+ void LayoutMetricsChanged(winrt::event_token const &token) noexcept;
147
+
148
+ winrt::event_token KeyDown(
149
+ winrt::Windows::Foundation::EventHandler<
150
+ winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs> const &handler) noexcept;
151
+ void KeyDown(winrt::event_token const &token) noexcept;
152
+ winrt::event_token KeyUp(
153
+ winrt::Windows::Foundation::EventHandler<
154
+ winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs> const &handler) noexcept;
155
+ void KeyUp(winrt::event_token const &token) noexcept;
156
+ winrt::event_token CharacterReceived(
157
+ winrt::Windows::Foundation::EventHandler<
158
+ winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs> const &handler) noexcept;
159
+ void CharacterReceived(winrt::event_token const &token) noexcept;
160
+ winrt::event_token PointerPressed(
161
+ winrt::Windows::Foundation::EventHandler<
162
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept;
163
+ void PointerPressed(winrt::event_token const &token) noexcept;
164
+ winrt::event_token PointerReleased(
165
+ winrt::Windows::Foundation::EventHandler<
166
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept;
167
+ void PointerReleased(winrt::event_token const &token) noexcept;
168
+ winrt::event_token PointerMoved(
169
+ winrt::Windows::Foundation::EventHandler<
170
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept;
171
+ void PointerMoved(winrt::event_token const &token) noexcept;
172
+ winrt::event_token PointerWheelChanged(
173
+ winrt::Windows::Foundation::EventHandler<
174
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept;
175
+ void PointerWheelChanged(winrt::event_token const &token) noexcept;
176
+ winrt::event_token PointerEntered(
177
+ winrt::Windows::Foundation::EventHandler<
178
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept;
179
+ void PointerEntered(winrt::event_token const &token) noexcept;
180
+ winrt::event_token PointerExited(
181
+ winrt::Windows::Foundation::EventHandler<
182
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept;
183
+ void PointerExited(winrt::event_token const &token) noexcept;
184
+ winrt::event_token PointerCaptureLost(
185
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView> const &handler) noexcept;
186
+ void PointerCaptureLost(winrt::event_token const &token) noexcept;
187
+
188
+ LayoutMetrics LayoutMetrics() const noexcept;
111
189
 
112
190
  bool TryFocus() noexcept;
113
191
 
@@ -123,6 +201,8 @@ struct ComponentView : public ComponentViewT<ComponentView> {
123
201
  virtual std::optional<std::string> getAcccessiblityValue() noexcept;
124
202
  virtual void setAcccessiblityValue(std::string &&value) noexcept;
125
203
  virtual bool getAcccessiblityIsReadOnly() noexcept;
204
+ virtual ToggleState getToggleState() noexcept;
205
+ virtual void Toggle() noexcept;
126
206
  winrt::Microsoft::ReactNative::IReactContext ReactContext() const noexcept;
127
207
 
128
208
  // Notify up the tree to bring the rect into view by scrolling as needed
@@ -131,7 +211,17 @@ struct ComponentView : public ComponentViewT<ComponentView> {
131
211
  virtual const winrt::Microsoft::ReactNative::IComponentProps userProps(
132
212
  facebook::react::Props::Shared const &props) noexcept;
133
213
 
134
- // Publicaly overridable APIs
214
+ void UserData(const winrt::IInspectable &userData) noexcept;
215
+ winrt::IInspectable UserData() const noexcept;
216
+
217
+ void CustomCommandHandler(const HandleCommandDelegate &handler) noexcept;
218
+ void UpdatePropsHandler(const UpdatePropsDelegate &handler) noexcept;
219
+ void UpdateStateHandler(const UpdateStateDelegate &handler) noexcept;
220
+ void UpdateEventEmitterHandler(const UpdateEventEmitterDelegate &handler) noexcept;
221
+ void MountChildComponentViewHandler(const MountChildComponentViewDelegate &handler) noexcept;
222
+ void UnmountChildComponentViewHandler(const UnmountChildComponentViewDelegate &handler) noexcept;
223
+ void FinalizeUpdateHandler(const UpdateFinalizerDelegate &handler) noexcept;
224
+
135
225
  virtual void MountChildComponentView(
136
226
  const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
137
227
  uint32_t index) noexcept;
@@ -141,11 +231,6 @@ struct ComponentView : public ComponentViewT<ComponentView> {
141
231
  virtual void HandleCommand(
142
232
  winrt::hstring commandName,
143
233
  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;
149
234
  virtual void FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask updateMask) noexcept;
150
235
  virtual void OnPointerEntered(
151
236
  const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept;
@@ -160,25 +245,68 @@ struct ComponentView : public ComponentViewT<ComponentView> {
160
245
  virtual void OnPointerWheelChanged(
161
246
  const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept;
162
247
  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;
248
+ virtual void OnKeyDown(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept;
249
+ virtual void OnKeyUp(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept;
169
250
  virtual void OnCharacterReceived(
170
- const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
171
251
  const winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs &args) noexcept;
172
252
 
173
253
  protected:
174
- const bool m_customComponent; // Is a user custom component, and so needs to call external override functions
254
+ bool m_customComponent : 1 {false}; // Is a user custom component, and so needs to call external override functions
255
+ bool m_mounted : 1 {false};
175
256
  const facebook::react::Tag m_tag;
257
+ winrt::IInspectable m_userData;
176
258
  winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *m_rootView{nullptr};
177
259
  mutable winrt::Microsoft::ReactNative::Composition::implementation::Theme *m_theme{nullptr};
178
260
  const winrt::Microsoft::ReactNative::ReactContext m_reactContext;
179
261
  winrt::Microsoft::ReactNative::ComponentView m_parent{nullptr};
262
+ facebook::react::LayoutMetrics m_layoutMetrics;
180
263
  winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::ReactNative::ComponentView> m_children{
181
264
  winrt::single_threaded_vector<winrt::Microsoft::ReactNative::ComponentView>()};
265
+
266
+ UpdatePropsDelegate m_updatePropsDelegate{nullptr};
267
+ UpdateStateDelegate m_updateStateDelegate{nullptr};
268
+ HandleCommandDelegate m_customCommandHandler{nullptr};
269
+ UpdateFinalizerDelegate m_finalizeUpdateHandler{nullptr};
270
+ MountChildComponentViewDelegate m_mountChildComponentViewHandler{nullptr};
271
+ UnmountChildComponentViewDelegate m_unmountChildComponentViewHandler{nullptr};
272
+ UpdateEventEmitterDelegate m_updateEventEmitterHandler{nullptr};
273
+
274
+ winrt::event<
275
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs>>
276
+ m_keyDownEvent;
277
+ winrt::event<
278
+ winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs>>
279
+ m_keyUpEvent;
280
+ winrt::event<winrt::Windows::Foundation::EventHandler<
281
+ winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs>>
282
+ m_characterReceivedEvent;
283
+ winrt::event<winrt::Windows::Foundation::EventHandler<
284
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs>>
285
+ m_pointerPressedEvent;
286
+ winrt::event<winrt::Windows::Foundation::EventHandler<
287
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs>>
288
+ m_pointerReleasedEvent;
289
+ winrt::event<winrt::Windows::Foundation::EventHandler<
290
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs>>
291
+ m_pointerMovedEvent;
292
+ winrt::event<winrt::Windows::Foundation::EventHandler<
293
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs>>
294
+ m_pointerWheelChangedEvent;
295
+ winrt::event<winrt::Windows::Foundation::EventHandler<
296
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs>>
297
+ m_pointerEnteredEvent;
298
+ winrt::event<winrt::Windows::Foundation::EventHandler<
299
+ winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs>>
300
+ m_pointerExitedEvent;
301
+ winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView>>
302
+ m_pointerCaptureLostEvent;
303
+
304
+ winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::LayoutMetricsChangedArgs>>
305
+ m_layoutMetricsChangedEvent;
306
+ winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView>>
307
+ m_destroyingEvent;
308
+ winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView>> m_mountedEvent;
309
+ winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::ComponentView>> m_unmountedEvent;
182
310
  winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::LosingFocusEventArgs>>
183
311
  m_losingFocusEvent;
184
312
  winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::GettingFocusEventArgs>>
@@ -199,9 +327,3 @@ bool walkTree(
199
327
  Mso::Functor<bool(const winrt::Microsoft::ReactNative::ComponentView &)> &fn) noexcept;
200
328
 
201
329
  } // 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) {}
@@ -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> {
@@ -160,6 +160,11 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPatternProvider(PATTE
160
160
  AddRef();
161
161
  }
162
162
 
163
+ if (patternId == UIA_TogglePatternId && (accessibilityRole == "switch" || accessibilityRole == "checkbox")) {
164
+ *pRetVal = static_cast<IToggleProvider *>(this);
165
+ AddRef();
166
+ }
167
+
163
168
  return S_OK;
164
169
  }
165
170
 
@@ -313,6 +318,21 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERT
313
318
  hr = pRetVal->bstrVal != nullptr ? S_OK : E_OUTOFMEMORY;
314
319
  break;
315
320
  }
321
+ case UIA_PositionInSetPropertyId: {
322
+ pRetVal->vt = VT_I4;
323
+ pRetVal->lVal = props->accessibilityPosInSet;
324
+ break;
325
+ }
326
+ case UIA_SizeOfSetPropertyId: {
327
+ pRetVal->vt = VT_I4;
328
+ pRetVal->lVal = props->accessibilitySetSize;
329
+ break;
330
+ }
331
+ case UIA_LiveSettingPropertyId: {
332
+ pRetVal->vt = VT_I4;
333
+ pRetVal->lVal = GetLiveSetting(props->accessibilityLiveRegion);
334
+ break;
335
+ }
316
336
  }
317
337
 
318
338
  return hr;
@@ -416,4 +436,27 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::get_IsReadOnly(BOOL *pRe
416
436
  return S_OK;
417
437
  }
418
438
 
439
+ HRESULT __stdcall CompositionDynamicAutomationProvider::get_ToggleState(ToggleState *pRetVal) {
440
+ if (pRetVal == nullptr)
441
+ return E_POINTER;
442
+ auto strongView = m_view.view();
443
+
444
+ if (!strongView)
445
+ return UIA_E_ELEMENTNOTAVAILABLE;
446
+
447
+ *pRetVal =
448
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->getToggleState();
449
+ return S_OK;
450
+ }
451
+
452
+ HRESULT __stdcall CompositionDynamicAutomationProvider::Toggle() {
453
+ auto strongView = m_view.view();
454
+
455
+ if (!strongView)
456
+ return UIA_E_ELEMENTNOTAVAILABLE;
457
+
458
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->Toggle();
459
+ return S_OK;
460
+ }
461
+
419
462
  } // namespace winrt::Microsoft::ReactNative::implementation
@@ -15,7 +15,8 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
15
15
  IRawElementProviderSimple,
16
16
  IInvokeProvider,
17
17
  IScrollItemProvider,
18
- IValueProvider> {
18
+ IValueProvider,
19
+ IToggleProvider> {
19
20
  public:
20
21
  CompositionDynamicAutomationProvider(
21
22
  const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView) noexcept;
@@ -46,6 +47,10 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
46
47
  virtual HRESULT __stdcall get_Value(BSTR *pRetVal) override;
47
48
  virtual HRESULT __stdcall get_IsReadOnly(BOOL *pRetVal) override;
48
49
 
50
+ // inherited via IToggleProivder
51
+ virtual HRESULT __stdcall get_ToggleState(ToggleState *pRetVal) override;
52
+ virtual HRESULT __stdcall Toggle() override;
53
+
49
54
  private:
50
55
  ::Microsoft::ReactNative::ReactTaggedView m_view;
51
56
  };