react-native-windows 0.75.4 → 0.75.5

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 (61) hide show
  1. package/Microsoft.ReactNative/ComponentView.idl +11 -0
  2. package/Microsoft.ReactNative/Composition.Input.idl +1 -0
  3. package/Microsoft.ReactNative/CompositionSwitcher.idl +3 -0
  4. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +7 -9
  5. package/Microsoft.ReactNative/Fabric/ComponentView.h +5 -6
  6. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +4 -0
  7. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +1 -0
  8. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +44 -13
  9. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +6 -1
  10. package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +1 -0
  11. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +11 -8
  12. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +2 -3
  13. package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +8 -6
  14. package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.h +1 -2
  15. package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +20 -6
  16. package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +13 -6
  17. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +2 -3
  18. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +1 -2
  19. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +72 -54
  20. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +14 -4
  21. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +26 -8
  22. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +5 -2
  23. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +18 -7
  24. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +1 -2
  25. package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +6 -6
  26. package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +1 -2
  27. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +97 -140
  28. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +8 -4
  29. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +14 -11
  30. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +4 -4
  31. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -13
  32. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h +0 -3
  33. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +29 -4
  34. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +2 -0
  35. package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +1 -2
  36. package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.h +1 -2
  37. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +28 -3
  38. package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +9 -2
  39. package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +8 -1
  40. package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +9 -0
  41. package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -0
  42. package/Microsoft.ReactNative/Modules/SampleTurboModule.cpp +104 -0
  43. package/Microsoft.ReactNative/Modules/SampleTurboModule.h +78 -0
  44. package/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +0 -7
  45. package/Microsoft.ReactNative/ReactHost/MsoReactContext.h +0 -5
  46. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +17 -1
  47. package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.cpp +59 -0
  48. package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.h +23 -0
  49. package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +179 -0
  50. package/Microsoft.ReactNative/ReactNativeAppBuilder.h +35 -0
  51. package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +69 -0
  52. package/Microsoft.ReactNative/ReactNativeIsland.idl +2 -0
  53. package/Microsoft.ReactNative/ReactNativeWin32App.cpp +82 -0
  54. package/Microsoft.ReactNative/ReactNativeWin32App.h +38 -0
  55. package/Microsoft.ReactNative/packages.lock.json +67 -40
  56. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  57. package/Shared/Shared.vcxitems +33 -0
  58. package/Shared/Shared.vcxitems.filters +1 -0
  59. package/Shared/TurboModuleManager.cpp +0 -3
  60. package/package.json +3 -3
  61. package/templates/cpp-app/windows/MyApp/MyApp.cpp +1 -0
@@ -34,6 +34,15 @@ namespace Microsoft.ReactNative
34
34
  All = 0x0000000F,
35
35
  };
36
36
 
37
+ enum FocusNavigationDirection
38
+ {
39
+ None,
40
+ Next,
41
+ Previous,
42
+ First,
43
+ Last,
44
+ };
45
+
37
46
  [webhosthidden]
38
47
  [experimental]
39
48
  interface IComponentState
@@ -46,6 +55,7 @@ namespace Microsoft.ReactNative
46
55
  [experimental]
47
56
  [webhosthidden]
48
57
  runtimeclass LosingFocusEventArgs : Microsoft.ReactNative.Composition.Input.RoutedEventArgs {
58
+ FocusNavigationDirection Direction { get; };
49
59
  Microsoft.ReactNative.ComponentView NewFocusedComponent { get; };
50
60
  Microsoft.ReactNative.ComponentView OldFocusedComponent { get; };
51
61
 
@@ -56,6 +66,7 @@ namespace Microsoft.ReactNative
56
66
  [experimental]
57
67
  [webhosthidden]
58
68
  runtimeclass GettingFocusEventArgs : Microsoft.ReactNative.Composition.Input.RoutedEventArgs {
69
+ FocusNavigationDirection Direction { get; };
59
70
  Microsoft.ReactNative.ComponentView NewFocusedComponent { get; };
60
71
  Microsoft.ReactNative.ComponentView OldFocusedComponent { get; };
61
72
 
@@ -106,6 +106,7 @@ namespace Microsoft.ReactNative.Composition.Input
106
106
  UInt64 Timestamp { get; };
107
107
  PointerPoint GetOffsetPoint(
108
108
  Windows.Foundation.Point offset);
109
+ Microsoft.UI.Input.PointerPoint Inner { get; };
109
110
  };
110
111
 
111
112
  runtimeclass PointerRoutedEventArgs : RoutedEventArgs
@@ -3,6 +3,7 @@
3
3
 
4
4
  #include "NamespaceRedirect.h"
5
5
  #include "DocString.h"
6
+ import "Composition.Input.idl";
6
7
 
7
8
  namespace Microsoft.ReactNative.Composition.Experimental
8
9
  {
@@ -112,6 +113,8 @@ namespace Microsoft.ReactNative.Composition.Experimental
112
113
  Windows.Foundation.Numerics.Vector3 ScrollPosition { get; };
113
114
  void ScrollBy(Windows.Foundation.Numerics.Vector3 offset, Boolean animate);
114
115
  void TryUpdatePosition(Windows.Foundation.Numerics.Vector3 position, Boolean animate);
116
+ void OnPointerPressed(Microsoft.ReactNative.Composition.Input.PointerRoutedEventArgs args);
117
+ Boolean Horizontal;
115
118
  }
116
119
 
117
120
  [webhosthidden]
@@ -256,16 +256,14 @@ void ComponentView::CustomCommandHandler(const HandleCommandDelegate &handler) n
256
256
  m_customCommandHandler = handler;
257
257
  }
258
258
 
259
- void ComponentView::HandleCommand(
260
- winrt::hstring commandName,
261
- const winrt::Microsoft::ReactNative::IJSValueReader &args) noexcept {
259
+ void ComponentView::HandleCommand(const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept {
262
260
  if (m_customCommandHandler) {
263
- m_customCommandHandler(*this, commandName, args);
261
+ m_customCommandHandler(*this, args);
264
262
  }
265
263
  }
266
264
 
267
- winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *
268
- ComponentView::rootComponentView() noexcept {
265
+ winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *ComponentView::rootComponentView()
266
+ const noexcept {
269
267
  if (m_rootView)
270
268
  return m_rootView;
271
269
 
@@ -285,7 +283,7 @@ void ComponentView::parent(const winrt::Microsoft::ReactNative::ComponentView &p
285
283
  m_parent = parent;
286
284
  if (!parent) {
287
285
  if (oldRootView && oldRootView->GetFocusedComponent() == *this) {
288
- oldRootView->TrySetFocusedComponent(oldParent);
286
+ oldRootView->TrySetFocusedComponent(oldParent, winrt::Microsoft::ReactNative::FocusNavigationDirection::None);
289
287
  }
290
288
  }
291
289
  if (parent) {
@@ -424,7 +422,7 @@ void ComponentView::GotFocus(winrt::event_token const &token) noexcept {
424
422
 
425
423
  bool ComponentView::TryFocus() noexcept {
426
424
  if (auto root = rootComponentView()) {
427
- return root->TrySetFocusedComponent(*get_strong());
425
+ return root->TrySetFocusedComponent(*get_strong(), winrt::Microsoft::ReactNative::FocusNavigationDirection::None);
428
426
  }
429
427
 
430
428
  return false;
@@ -638,7 +636,7 @@ winrt::IInspectable ComponentView::EnsureUiaProvider() noexcept {
638
636
  return nullptr;
639
637
  }
640
638
 
641
- std::optional<std::string> ComponentView::getAcccessiblityValue() noexcept {
639
+ std::optional<std::string> ComponentView::getAccessiblityValue() noexcept {
642
640
  return std::nullopt;
643
641
  }
644
642
 
@@ -93,7 +93,8 @@ struct ComponentView : public ComponentViewT<ComponentView> {
93
93
  facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept;
94
94
  virtual void prepareForRecycle() noexcept;
95
95
  virtual facebook::react::Props::Shared props() noexcept;
96
- virtual winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *rootComponentView() noexcept;
96
+ virtual winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *rootComponentView()
97
+ const noexcept;
97
98
  virtual void parent(const winrt::Microsoft::ReactNative::ComponentView &parent) noexcept;
98
99
  virtual winrt::Microsoft::ReactNative::ComponentView Parent() const noexcept;
99
100
  virtual winrt::IVectorView<winrt::Microsoft::ReactNative::ComponentView> Children() const noexcept;
@@ -198,7 +199,7 @@ struct ComponentView : public ComponentViewT<ComponentView> {
198
199
  virtual facebook::react::Tag
199
200
  hitTest(facebook::react::Point pt, facebook::react::Point &localPt, bool ignorePointerEvents = false) const noexcept;
200
201
  virtual winrt::IInspectable EnsureUiaProvider() noexcept;
201
- virtual std::optional<std::string> getAcccessiblityValue() noexcept;
202
+ virtual std::optional<std::string> getAccessiblityValue() noexcept;
202
203
  virtual void setAcccessiblityValue(std::string &&value) noexcept;
203
204
  virtual bool getAcccessiblityIsReadOnly() noexcept;
204
205
  virtual ToggleState getToggleState() noexcept;
@@ -228,9 +229,7 @@ struct ComponentView : public ComponentViewT<ComponentView> {
228
229
  virtual void UnmountChildComponentView(
229
230
  const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
230
231
  uint32_t index) noexcept;
231
- virtual void HandleCommand(
232
- winrt::hstring commandName,
233
- const winrt::Microsoft::ReactNative::IJSValueReader &args) noexcept;
232
+ virtual void HandleCommand(const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept;
234
233
  virtual void FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask updateMask) noexcept;
235
234
  virtual void OnPointerEntered(
236
235
  const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept;
@@ -255,7 +254,7 @@ struct ComponentView : public ComponentViewT<ComponentView> {
255
254
  bool m_mounted : 1 {false};
256
255
  const facebook::react::Tag m_tag;
257
256
  winrt::IInspectable m_userData;
258
- winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *m_rootView{nullptr};
257
+ mutable winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *m_rootView{nullptr};
259
258
  mutable winrt::Microsoft::ReactNative::Composition::implementation::Theme *m_theme{nullptr};
260
259
  const winrt::Microsoft::ReactNative::ReactContext m_reactContext;
261
260
  winrt::Microsoft::ReactNative::ComponentView m_parent{nullptr};
@@ -637,6 +637,10 @@ bool PointerPoint::IsPointerMessage(uint32_t message) const noexcept {
637
637
  return (message >= WM_POINTERFIRST && message <= WM_POINTERLAST);
638
638
  }
639
639
 
640
+ winrt::Microsoft::UI::Input::PointerPoint PointerPoint::Inner() const noexcept {
641
+ return m_sysPointerPoint;
642
+ }
643
+
640
644
  PointerRoutedEventArgs::PointerRoutedEventArgs(
641
645
  const winrt::Microsoft::ReactNative::ReactContext &context,
642
646
  facebook::react::Tag tag,
@@ -198,6 +198,7 @@ struct PointerPoint : PointerPointT<PointerPoint> {
198
198
  uint64_t Timestamp() const noexcept;
199
199
  winrt::Microsoft::ReactNative::Composition::Input::PointerPoint GetOffsetPoint(
200
200
  const winrt::Windows::Foundation::Point &offset) const noexcept;
201
+ winrt::Microsoft::UI::Input::PointerPoint Inner() const noexcept;
201
202
 
202
203
  private:
203
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;
@@ -365,6 +365,8 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::Invoke() {
365
365
  if (spProviderSimple != nullptr) {
366
366
  UiaRaiseAutomationEvent(spProviderSimple.get(), UIA_Invoke_InvokedEventId);
367
367
  }
368
+ DispatchAccessibilityAction(m_view, "invoke");
369
+ DispatchAccessibilityAction(m_view, "activate");
368
370
 
369
371
  return S_OK;
370
372
  }
@@ -378,6 +380,7 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::ScrollIntoView() {
378
380
  winrt::Microsoft::ReactNative::implementation::BringIntoViewOptions scrollOptions;
379
381
  winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)
380
382
  ->StartBringIntoView(std::move(scrollOptions));
383
+ DispatchAccessibilityAction(m_view, "scrollIntoView");
381
384
 
382
385
  return S_OK;
383
386
  }
@@ -406,6 +409,7 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::SetValue(LPCWSTR val) {
406
409
 
407
410
  winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)
408
411
  ->setAcccessiblityValue(winrt::to_string(val));
412
+ DispatchAccessibilityAction(m_view, "setValue");
409
413
  return S_OK;
410
414
  }
411
415
 
@@ -418,7 +422,7 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::get_Value(BSTR *pRetVal)
418
422
  return UIA_E_ELEMENTNOTAVAILABLE;
419
423
 
420
424
  *pRetVal = StringToBSTR(winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)
421
- ->getAcccessiblityValue()
425
+ ->getAccessiblityValue()
422
426
  .value_or(""));
423
427
  return S_OK;
424
428
  }
@@ -456,6 +460,7 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::Toggle() {
456
460
  return UIA_E_ELEMENTNOTAVAILABLE;
457
461
 
458
462
  winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->Toggle();
463
+ DispatchAccessibilityAction(m_view, "toggle");
459
464
  return S_OK;
460
465
  }
461
466
 
@@ -102,6 +102,7 @@ void CompositionHwndHost::UpdateSize() noexcept {
102
102
  // Do not relayout when minimized
103
103
  if (!IsIconic(m_hwnd)) {
104
104
  winrt::Microsoft::ReactNative::LayoutConstraints constraints;
105
+ constraints.LayoutDirection = winrt::Microsoft::ReactNative::LayoutDirection::Undefined;
105
106
  constraints.MinimumSize = constraints.MaximumSize = size;
106
107
  m_compRootView.Arrange(constraints, {0, 0});
107
108
  }
@@ -248,23 +248,26 @@ void ComponentView::updateEventEmitter(facebook::react::EventEmitter::Shared con
248
248
  base_type::updateEventEmitter(eventEmitter);
249
249
  }
250
250
 
251
- void ComponentView::HandleCommand(
252
- winrt::hstring commandName,
253
- const winrt::Microsoft::ReactNative::IJSValueReader &args) noexcept {
251
+ void ComponentView::HandleCommand(const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept {
252
+ base_type::HandleCommand(args);
253
+ if (args.Handled())
254
+ return;
255
+
256
+ auto commandName = args.CommandName();
254
257
  if (commandName == L"focus") {
255
258
  if (auto root = rootComponentView()) {
256
- root->TrySetFocusedComponent(*get_strong());
259
+ root->TrySetFocusedComponent(*get_strong(), winrt::Microsoft::ReactNative::FocusNavigationDirection::None);
257
260
  }
258
261
  return;
259
262
  }
260
263
  if (commandName == L"blur") {
261
264
  if (auto root = rootComponentView()) {
262
- root->TrySetFocusedComponent(nullptr); // Todo store this component as previously focused element
265
+ root->TrySetFocusedComponent(
266
+ nullptr, winrt::Microsoft::ReactNative::FocusNavigationDirection::None); // Todo store this component as
267
+ // previously focused element
263
268
  }
264
269
  return;
265
270
  }
266
-
267
- base_type::HandleCommand(commandName, args);
268
271
  }
269
272
 
270
273
  bool ComponentView::CapturePointer(const winrt::Microsoft::ReactNative::Composition::Input::Pointer &pointer) noexcept {
@@ -1310,7 +1313,7 @@ void ComponentView::updateAccessibilityProps(
1310
1313
  newViewProps.accessibilityLiveRegion);
1311
1314
  }
1312
1315
 
1313
- std::optional<std::string> ComponentView::getAcccessiblityValue() noexcept {
1316
+ std::optional<std::string> ComponentView::getAccessiblityValue() noexcept {
1314
1317
  return std::static_pointer_cast<const facebook::react::ViewProps>(props())->accessibilityValue.text;
1315
1318
  }
1316
1319
 
@@ -38,8 +38,7 @@ struct ComponentView : public ComponentViewT<
38
38
  virtual winrt::Microsoft::ReactNative::Composition::Experimental::IVisual OuterVisual() const noexcept;
39
39
  void updateEventEmitter(facebook::react::EventEmitter::Shared const &eventEmitter) noexcept override;
40
40
  const facebook::react::SharedViewEventEmitter &GetEventEmitter() const noexcept;
41
- void HandleCommand(winrt::hstring commandName, const winrt::Microsoft::ReactNative::IJSValueReader &args) noexcept
42
- override;
41
+ void HandleCommand(const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept override;
43
42
  facebook::react::Props::Shared props() noexcept override;
44
43
  virtual const facebook::react::SharedViewProps &viewProps() const noexcept {
45
44
  static facebook::react::SharedViewProps emptyProps;
@@ -92,7 +91,7 @@ struct ComponentView : public ComponentViewT<
92
91
  void EnsureTransformMatrixFacade() noexcept;
93
92
 
94
93
  winrt::IInspectable EnsureUiaProvider() noexcept override;
95
- std::optional<std::string> getAcccessiblityValue() noexcept override;
94
+ std::optional<std::string> getAccessiblityValue() noexcept override;
96
95
  void setAcccessiblityValue(std::string &&value) noexcept override;
97
96
  bool getAcccessiblityIsReadOnly() noexcept override;
98
97
  ToggleState getToggleState() noexcept override;
@@ -67,17 +67,21 @@ struct TraceUpdate {
67
67
  };
68
68
 
69
69
  void DebuggingOverlayComponentView::HandleCommand(
70
- winrt::hstring commandName,
71
- const winrt::Microsoft::ReactNative::IJSValueReader &args) noexcept {
70
+ const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept {
71
+ base_type::HandleCommand(args);
72
+ if (args.Handled())
73
+ return;
74
+
75
+ auto commandName = args.CommandName();
72
76
  if (commandName == L"highlightTraceUpdates") {
73
77
  std::vector<TraceUpdate> updates;
74
- winrt::Microsoft::ReactNative::ReadArgs(args, updates);
78
+ winrt::Microsoft::ReactNative::ReadArgs(args.CommandArgs(), updates);
75
79
  // TODO should create visuals that get removed after 2 seconds
76
80
  return;
77
81
  }
78
82
  if (commandName == L"highlightElements") {
79
83
  std::vector<ElementRectangle> elements;
80
- winrt::Microsoft::ReactNative::ReadArgs(args, elements);
84
+ winrt::Microsoft::ReactNative::ReadArgs(args.CommandArgs(), elements);
81
85
 
82
86
  if (auto root = rootComponentView()) {
83
87
  auto rootVisual = root->OuterVisual();
@@ -106,8 +110,6 @@ void DebuggingOverlayComponentView::HandleCommand(
106
110
  }
107
111
  return;
108
112
  }
109
-
110
- base_type::HandleCommand(commandName, args);
111
113
  }
112
114
 
113
115
  } // namespace winrt::Microsoft::ReactNative::Composition::implementation
@@ -29,8 +29,7 @@ struct DebuggingOverlayComponentView
29
29
  facebook::react::Tag tag,
30
30
  winrt::Microsoft::ReactNative::ReactContext const &reactContext);
31
31
 
32
- void HandleCommand(winrt::hstring commandName, const winrt::Microsoft::ReactNative::IJSValueReader &args) noexcept
33
- override;
32
+ void HandleCommand(const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept override;
34
33
 
35
34
  private:
36
35
  uint32_t m_activeOverlays{0};
@@ -22,19 +22,26 @@ int32_t GotFocusEventArgs::OriginalSource() noexcept {
22
22
 
23
23
  LosingFocusEventArgs::LosingFocusEventArgs(
24
24
  const winrt::Microsoft::ReactNative::ComponentView &originalSource,
25
+ winrt::Microsoft::ReactNative::FocusNavigationDirection direction,
25
26
  const winrt::Microsoft::ReactNative::ComponentView &oldFocusedComponent,
26
27
  const winrt::Microsoft::ReactNative::ComponentView &newFocusedComponent)
27
28
  : m_originalSource(originalSource ? originalSource.Tag() : -1),
29
+ m_direction(direction),
28
30
  m_old(oldFocusedComponent),
29
31
  m_new(newFocusedComponent) {}
30
32
 
31
- int32_t LosingFocusEventArgs::OriginalSource() noexcept {
33
+ int32_t LosingFocusEventArgs::OriginalSource() const noexcept {
32
34
  return m_originalSource;
33
35
  }
34
- winrt::Microsoft::ReactNative::ComponentView LosingFocusEventArgs::NewFocusedComponent() noexcept {
36
+
37
+ winrt::Microsoft::ReactNative::FocusNavigationDirection LosingFocusEventArgs::Direction() const noexcept {
38
+ return m_direction;
39
+ }
40
+
41
+ winrt::Microsoft::ReactNative::ComponentView LosingFocusEventArgs::NewFocusedComponent() const noexcept {
35
42
  return m_new;
36
43
  }
37
- winrt::Microsoft::ReactNative::ComponentView LosingFocusEventArgs::OldFocusedComponent() noexcept {
44
+ winrt::Microsoft::ReactNative::ComponentView LosingFocusEventArgs::OldFocusedComponent() const noexcept {
38
45
  return m_old;
39
46
  }
40
47
 
@@ -58,19 +65,26 @@ void LosingFocusEventArgs::TrySetNewFocusedComponent(
58
65
 
59
66
  GettingFocusEventArgs::GettingFocusEventArgs(
60
67
  const winrt::Microsoft::ReactNative::ComponentView &originalSource,
68
+ winrt::Microsoft::ReactNative::FocusNavigationDirection direction,
61
69
  const winrt::Microsoft::ReactNative::ComponentView &oldFocusedComponent,
62
70
  const winrt::Microsoft::ReactNative::ComponentView &newFocusedComponent)
63
71
  : m_originalSource(originalSource ? originalSource.Tag() : -1),
72
+ m_direction(direction),
64
73
  m_old(oldFocusedComponent),
65
74
  m_new(newFocusedComponent) {}
66
75
 
67
- int32_t GettingFocusEventArgs::OriginalSource() noexcept {
76
+ int32_t GettingFocusEventArgs::OriginalSource() const noexcept {
68
77
  return m_originalSource;
69
78
  }
70
- winrt::Microsoft::ReactNative::ComponentView GettingFocusEventArgs::NewFocusedComponent() noexcept {
79
+
80
+ winrt::Microsoft::ReactNative::FocusNavigationDirection GettingFocusEventArgs::Direction() const noexcept {
81
+ return m_direction;
82
+ }
83
+
84
+ winrt::Microsoft::ReactNative::ComponentView GettingFocusEventArgs::NewFocusedComponent() const noexcept {
71
85
  return m_new;
72
86
  }
73
- winrt::Microsoft::ReactNative::ComponentView GettingFocusEventArgs::OldFocusedComponent() noexcept {
87
+ winrt::Microsoft::ReactNative::ComponentView GettingFocusEventArgs::OldFocusedComponent() const noexcept {
74
88
  return m_old;
75
89
  }
76
90
 
@@ -32,17 +32,21 @@ struct LosingFocusEventArgs
32
32
  : winrt::Microsoft::ReactNative::implementation::LosingFocusEventArgsT<LosingFocusEventArgs> {
33
33
  LosingFocusEventArgs(
34
34
  const winrt::Microsoft::ReactNative::ComponentView &originalSource,
35
+ winrt::Microsoft::ReactNative::FocusNavigationDirection direction,
35
36
  const winrt::Microsoft::ReactNative::ComponentView &oldFocusedComponent,
36
37
  const winrt::Microsoft::ReactNative::ComponentView &newFocusedComponent);
37
- int32_t OriginalSource() noexcept;
38
- winrt::Microsoft::ReactNative::ComponentView NewFocusedComponent() noexcept;
39
- winrt::Microsoft::ReactNative::ComponentView OldFocusedComponent() noexcept;
38
+ int32_t OriginalSource() const noexcept;
39
+ winrt::Microsoft::ReactNative::FocusNavigationDirection Direction() const noexcept;
40
+
41
+ winrt::Microsoft::ReactNative::ComponentView NewFocusedComponent() const noexcept;
42
+ winrt::Microsoft::ReactNative::ComponentView OldFocusedComponent() const noexcept;
40
43
 
41
44
  void TryCancel() noexcept;
42
45
  void TrySetNewFocusedComponent(const winrt::Microsoft::ReactNative::ComponentView &newFocusedComponent) noexcept;
43
46
 
44
47
  private:
45
48
  const int32_t m_originalSource;
49
+ const winrt::Microsoft::ReactNative::FocusNavigationDirection m_direction;
46
50
  winrt::Microsoft::ReactNative::ComponentView m_old{nullptr};
47
51
  winrt::Microsoft::ReactNative::ComponentView m_new{nullptr};
48
52
  };
@@ -51,17 +55,20 @@ struct GettingFocusEventArgs
51
55
  : winrt::Microsoft::ReactNative::implementation::GettingFocusEventArgsT<GettingFocusEventArgs> {
52
56
  GettingFocusEventArgs(
53
57
  const winrt::Microsoft::ReactNative::ComponentView &originalSource,
58
+ winrt::Microsoft::ReactNative::FocusNavigationDirection direction,
54
59
  const winrt::Microsoft::ReactNative::ComponentView &oldFocusedComponent,
55
60
  const winrt::Microsoft::ReactNative::ComponentView &newFocusedComponent);
56
- int32_t OriginalSource() noexcept;
57
- winrt::Microsoft::ReactNative::ComponentView NewFocusedComponent() noexcept;
58
- winrt::Microsoft::ReactNative::ComponentView OldFocusedComponent() noexcept;
61
+ int32_t OriginalSource() const noexcept;
62
+ winrt::Microsoft::ReactNative::FocusNavigationDirection Direction() const noexcept;
63
+ winrt::Microsoft::ReactNative::ComponentView NewFocusedComponent() const noexcept;
64
+ winrt::Microsoft::ReactNative::ComponentView OldFocusedComponent() const noexcept;
59
65
 
60
66
  void TryCancel() noexcept;
61
67
  void TrySetNewFocusedComponent(const winrt::Microsoft::ReactNative::ComponentView &newFocusedComponent) noexcept;
62
68
 
63
69
  private:
64
70
  const int32_t m_originalSource;
71
+ const winrt::Microsoft::ReactNative::FocusNavigationDirection m_direction;
65
72
  winrt::Microsoft::ReactNative::ComponentView m_old{nullptr};
66
73
  winrt::Microsoft::ReactNative::ComponentView m_new{nullptr};
67
74
  };
@@ -191,9 +191,8 @@ void WindowsModalHostComponentView::UnmountChildComponentView(
191
191
  }
192
192
 
193
193
  void WindowsModalHostComponentView::HandleCommand(
194
- winrt::hstring commandName,
195
- const winrt::Microsoft::ReactNative::IJSValueReader &args) noexcept {
196
- Super::HandleCommand(commandName, args);
194
+ const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept {
195
+ Super::HandleCommand(args);
197
196
  }
198
197
 
199
198
  void WindowsModalHostComponentView::updateProps(
@@ -28,8 +28,7 @@ struct WindowsModalHostComponentView
28
28
  void UnmountChildComponentView(
29
29
  const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
30
30
  uint32_t index) noexcept override;
31
- void HandleCommand(winrt::hstring commandName, const winrt::Microsoft::ReactNative::IJSValueReader &args) noexcept
32
- override;
31
+ void HandleCommand(const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept override;
33
32
  void updateState(facebook::react::State::Shared const &state, facebook::react::State::Shared const &oldState) noexcept
34
33
  override;
35
34