react-native-windows 0.74.28 → 0.74.30

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 (71) hide show
  1. package/Libraries/Components/Button.windows.js +9 -0
  2. package/Libraries/Components/Pressable/Pressable.windows.js +9 -0
  3. package/Libraries/Components/TextInput/TextInput.windows.js +11 -1
  4. package/Libraries/Components/Touchable/TouchableBounce.windows.js +225 -0
  5. package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +373 -0
  6. package/Libraries/Components/Touchable/TouchableOpacity.windows.js +7 -0
  7. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +10 -0
  8. package/Libraries/Components/View/View.windows.js +11 -1
  9. package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
  10. package/Libraries/Components/View/ViewAccessibility.windows.js +5 -2
  11. package/Libraries/Components/View/ViewPropTypes.windows.js +3 -0
  12. package/Libraries/Image/Image.windows.js +7 -0
  13. package/Libraries/Text/Text.windows.js +11 -1
  14. package/Libraries/Text/TextProps.windows.js +3 -0
  15. package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
  16. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +1 -2
  17. package/Microsoft.ReactNative/Fabric/ComponentView.h +1 -1
  18. package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
  19. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +293 -9
  20. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +28 -1
  21. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +13 -32
  22. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -3
  23. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +1 -1
  24. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
  25. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +18 -5
  26. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +1 -1
  27. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +191 -329
  28. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
  29. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +66 -0
  30. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
  31. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +21 -0
  32. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -4
  33. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +79 -19
  34. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
  35. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +71 -17
  36. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +16 -0
  37. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +1 -1
  38. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +1 -1
  39. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +62 -33
  40. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +5 -2
  41. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +1 -6
  42. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
  43. package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
  44. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +5 -0
  45. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +19 -1
  46. package/Microsoft.ReactNative/ReactNativeHost.cpp +5 -0
  47. package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
  48. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +6 -2
  49. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  50. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +253 -0
  51. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +799 -0
  52. package/Shared/Shared.vcxitems +3 -2
  53. package/Shared/Shared.vcxitems.filters +2 -3
  54. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +204 -0
  55. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +287 -0
  56. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +192 -0
  57. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +216 -0
  58. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +242 -0
  59. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +259 -0
  60. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +226 -0
  61. package/codegen/react/components/rnwcore/InputAccessory.g.h +192 -0
  62. package/codegen/react/components/rnwcore/ModalHostView.g.h +271 -0
  63. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +238 -0
  64. package/codegen/react/components/rnwcore/SafeAreaView.g.h +189 -0
  65. package/codegen/react/components/rnwcore/Switch.g.h +255 -0
  66. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +192 -0
  67. package/just-task.js +1 -1
  68. package/package.json +1 -1
  69. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
  70. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
  71. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
@@ -16,8 +16,11 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
16
16
  IInvokeProvider,
17
17
  IScrollItemProvider,
18
18
  IValueProvider,
19
+ IRangeValueProvider,
19
20
  IToggleProvider,
20
- IExpandCollapseProvider> {
21
+ IExpandCollapseProvider,
22
+ ISelectionProvider,
23
+ ISelectionItemProvider> {
21
24
  public:
22
25
  CompositionDynamicAutomationProvider(
23
26
  const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView) noexcept;
@@ -48,6 +51,14 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
48
51
  virtual HRESULT __stdcall get_Value(BSTR *pRetVal) override;
49
52
  virtual HRESULT __stdcall get_IsReadOnly(BOOL *pRetVal) override;
50
53
 
54
+ // inherited via IRangeValueProvider
55
+ virtual HRESULT __stdcall get_LargeChange(double *pRetVal) override;
56
+ virtual HRESULT __stdcall get_Maximum(double *pRetVal) override;
57
+ virtual HRESULT __stdcall get_Minimum(double *pRetVal) override;
58
+ virtual HRESULT __stdcall get_SmallChange(double *pRetVal) override;
59
+ virtual HRESULT __stdcall get_Value(double *pRetVal) override;
60
+ virtual HRESULT __stdcall SetValue(double val) override;
61
+
51
62
  // inherited via IToggleProvider
52
63
  virtual HRESULT __stdcall get_ToggleState(ToggleState *pRetVal) override;
53
64
  virtual HRESULT __stdcall Toggle() override;
@@ -57,8 +68,24 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
57
68
  virtual HRESULT __stdcall Expand() override;
58
69
  virtual HRESULT __stdcall Collapse() override;
59
70
 
71
+ // inherited via ISelectionProvider
72
+ virtual HRESULT __stdcall get_CanSelectMultiple(BOOL *pRetVal) override;
73
+ virtual HRESULT __stdcall get_IsSelectionRequired(BOOL *pRetVal) override;
74
+ virtual HRESULT __stdcall GetSelection(SAFEARRAY **pRetVal) override;
75
+
76
+ // inherited via ISelectionItemProvider
77
+ virtual HRESULT __stdcall AddToSelection() override;
78
+ virtual HRESULT __stdcall get_IsSelected(BOOL *pRetVal) override;
79
+ virtual HRESULT __stdcall get_SelectionContainer(IRawElementProviderSimple **pRetVal) override;
80
+ virtual HRESULT __stdcall RemoveFromSelection() override;
81
+ virtual HRESULT __stdcall Select() override;
82
+
83
+ void AddToSelectionItems(winrt::com_ptr<IRawElementProviderSimple> &item);
84
+ void RemoveFromSelectionItems(winrt::com_ptr<IRawElementProviderSimple> &item);
85
+
60
86
  private:
61
87
  ::Microsoft::ReactNative::ReactTaggedView m_view;
88
+ std::vector<winrt::com_ptr<IRawElementProviderSimple>> m_selectionItems;
62
89
  };
63
90
 
64
91
  } // namespace winrt::Microsoft::ReactNative::implementation
@@ -142,9 +142,8 @@ struct CompositionInputKeyboardSource : winrt::implements<
142
142
 
143
143
  CompositionEventHandler::CompositionEventHandler(
144
144
  const winrt::Microsoft::ReactNative::ReactContext &context,
145
- const winrt::Microsoft::ReactNative::ReactNativeIsland &reactNativeIsland,
146
- const int fragmentTag)
147
- : m_fragmentTag(fragmentTag), m_context(context), m_wkRootView(reactNativeIsland) {}
145
+ const winrt::Microsoft::ReactNative::ReactNativeIsland &reactNativeIsland)
146
+ : m_context(context), m_wkRootView(reactNativeIsland) {}
148
147
 
149
148
  void CompositionEventHandler::Initialize() noexcept {
150
149
  #ifdef USE_WINUI3
@@ -348,11 +347,8 @@ facebook::react::SurfaceId CompositionEventHandler::SurfaceId() const noexcept {
348
347
 
349
348
  winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView &
350
349
  CompositionEventHandler::RootComponentView() const noexcept {
351
- auto rootComponentViewDescriptor = (::Microsoft::ReactNative::FabricUIManager::FromProperties(m_context.Properties()))
352
- ->GetViewRegistry()
353
- .componentViewDescriptorWithTag(SurfaceId());
354
- return *rootComponentViewDescriptor.view
355
- .as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>();
350
+ auto island = m_wkRootView.get();
351
+ return *winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(island)->GetComponentView();
356
352
  }
357
353
 
358
354
  void CompositionEventHandler::onPointerWheelChanged(
@@ -365,6 +361,9 @@ void CompositionEventHandler::onPointerWheelChanged(
365
361
  facebook::react::Point ptLocal;
366
362
  facebook::react::Point ptScaled = {static_cast<float>(position.X), static_cast<float>(position.Y)};
367
363
 
364
+ // In the case of a sub rootview, we may have a non-zero origin. hitTest takes a pt in the parent coords, so we
365
+ // need to apply the current origin
366
+ ptScaled += RootComponentView().layoutMetrics().frame.origin;
368
367
  auto tag = RootComponentView().hitTest(ptScaled, ptLocal);
369
368
 
370
369
  if (tag == -1)
@@ -981,6 +980,11 @@ void CompositionEventHandler::getTargetPointerArgs(
981
980
  tag = -1;
982
981
 
983
982
  ptScaled = {position.X, position.Y};
983
+
984
+ // In the case of a sub rootview, we may have a non-zero origin. hitTest takes a pt in the parent coords, so we need
985
+ // to apply the current origin
986
+ ptScaled += RootComponentView().layoutMetrics().frame.origin;
987
+
984
988
  if (std::find(m_capturedPointers.begin(), m_capturedPointers.end(), pointerId) != m_capturedPointers.end()) {
985
989
  assert(m_pointerCapturingComponentTag != -1);
986
990
  tag = m_pointerCapturingComponentTag;
@@ -993,30 +997,7 @@ void CompositionEventHandler::getTargetPointerArgs(
993
997
  ptLocal.y = ptScaled.y - (clientRect.top / strongRootView.ScaleFactor());
994
998
  }
995
999
  } else {
996
- if (m_fragmentTag == -1) {
997
- tag = RootComponentView().hitTest(ptScaled, ptLocal);
998
- return;
999
- }
1000
-
1001
- // check if the fragment tag exists
1002
- if (!fabricuiManager->GetViewRegistry().findComponentViewWithTag(m_fragmentTag)) {
1003
- return;
1004
- }
1005
-
1006
- auto fagmentView = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(m_fragmentTag).view;
1007
- auto fagmentchildren = fagmentView.Children();
1008
-
1009
- // call the hitTest with the fargment as the RootComponent
1010
- for (auto index = fagmentchildren.Size(); index > 0; index--) {
1011
- auto childView = fagmentchildren.GetAt(index - 1);
1012
- auto targetTag =
1013
- winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(childView)->hitTest(
1014
- ptScaled, ptLocal);
1015
- if (targetTag != -1) {
1016
- tag = targetTag;
1017
- break;
1018
- }
1019
- }
1000
+ tag = RootComponentView().hitTest(ptScaled, ptLocal);
1020
1001
  }
1021
1002
  }
1022
1003
 
@@ -31,8 +31,7 @@ class CompositionEventHandler : public std::enable_shared_from_this<CompositionE
31
31
  public:
32
32
  CompositionEventHandler(
33
33
  const winrt::Microsoft::ReactNative::ReactContext &context,
34
- const winrt::Microsoft::ReactNative::ReactNativeIsland &ReactNativeIsland,
35
- const int fragmentTag);
34
+ const winrt::Microsoft::ReactNative::ReactNativeIsland &ReactNativeIsland);
36
35
  virtual ~CompositionEventHandler();
37
36
 
38
37
  void Initialize() noexcept;
@@ -152,7 +151,6 @@ class CompositionEventHandler : public std::enable_shared_from_this<CompositionE
152
151
 
153
152
  std::map<PointerId, ActiveTouch> m_activeTouches; // iOS is map of touch event args to ActiveTouch..?
154
153
  PointerId m_touchId = 0;
155
- int m_fragmentTag = -1;
156
154
 
157
155
  std::map<PointerId, std::vector<ReactTaggedView>> m_currentlyHoveredViewsPerPointer;
158
156
  winrt::weak_ref<winrt::Microsoft::ReactNative::ReactNativeIsland> m_wkRootView;
@@ -167,7 +167,7 @@ HRESULT __stdcall CompositionRootAutomationProvider::get_ProviderOptions(Provide
167
167
  return S_OK;
168
168
  }
169
169
 
170
- winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *
170
+ winrt::com_ptr<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>
171
171
  CompositionRootAutomationProvider::rootComponentView() noexcept {
172
172
  if (auto rootView = m_wkRootView.get()) {
173
173
  auto innerRootView = winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(rootView);
@@ -63,7 +63,8 @@ class CompositionRootAutomationProvider : public winrt::implements<
63
63
  };
64
64
 
65
65
  private:
66
- winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *rootComponentView() noexcept;
66
+ winrt::com_ptr<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>
67
+ rootComponentView() noexcept;
67
68
 
68
69
  HRESULT AdvisePropertiesAdded(SAFEARRAY *psaProperties) noexcept;
69
70
  HRESULT AdvisePropertiesRemoved(SAFEARRAY *psaProperties) noexcept;
@@ -468,7 +468,7 @@ bool ComponentView::CapturePointer(const winrt::Microsoft::ReactNative::Composit
468
468
  if (!root)
469
469
  return false;
470
470
 
471
- auto rootView{uiManager->GetReactNativeIsland(root->Tag())};
471
+ auto rootView{root->ReactNativeIsland()};
472
472
  if (!rootView) {
473
473
  return false;
474
474
  }
@@ -487,7 +487,7 @@ void ComponentView::ReleasePointerCapture(
487
487
  if (!root)
488
488
  return;
489
489
 
490
- auto rootView{uiManager->GetReactNativeIsland(root->Tag())};
490
+ auto rootView{root->ReactNativeIsland()};
491
491
  if (!rootView) {
492
492
  return;
493
493
  }
@@ -747,10 +747,23 @@ void ComponentView::updateAccessibilityProps(
747
747
  UIA_LiveSettingPropertyId,
748
748
  oldViewProps.accessibilityLiveRegion,
749
749
  newViewProps.accessibilityLiveRegion);
750
+
751
+ if ((oldViewProps.accessibilityState.has_value() && oldViewProps.accessibilityState->selected.has_value()) !=
752
+ ((newViewProps.accessibilityState.has_value() && newViewProps.accessibilityState->selected.has_value()))) {
753
+ auto compProvider =
754
+ m_uiaProvider.try_as<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>();
755
+ if (compProvider) {
756
+ if ((newViewProps.accessibilityState.has_value() && newViewProps.accessibilityState->selected.has_value())) {
757
+ winrt::Microsoft::ReactNative::implementation::AddSelectionItemsToContainer(compProvider.get());
758
+ } else {
759
+ winrt::Microsoft::ReactNative::implementation::RemoveSelectionItemsFromContainer(compProvider.get());
760
+ }
761
+ }
762
+ }
750
763
  }
751
764
 
752
- std::optional<std::string> ComponentView::getAcccessiblityValue() noexcept {
753
- return std::static_pointer_cast<const facebook::react::ViewProps>(props())->accessibilityValue.text;
765
+ std::optional<std::string> ComponentView::getAccessiblityValue() noexcept {
766
+ return std::static_pointer_cast<const facebook::react::ViewProps>(props())->accessibilityValue.text.value();
754
767
  }
755
768
 
756
769
  void ComponentView::setAcccessiblityValue(std::string &&value) noexcept {
@@ -1301,7 +1314,7 @@ winrt::Microsoft::ReactNative::ComponentView lastDeepChild(
1301
1314
  }
1302
1315
 
1303
1316
  // Walks the tree calling the function fn on each node.
1304
- // If fn returns true, then walkTree stops itterating over the tree, and returns true.
1317
+ // If fn returns true, then walkTree stops iterating over the tree, and returns true.
1305
1318
  // If the tree walk completes without fn returning true, then walkTree returns false.
1306
1319
  bool walkTree(
1307
1320
  const winrt::Microsoft::ReactNative::ComponentView &view,
@@ -100,7 +100,7 @@ struct ComponentView : public ComponentViewT<
100
100
  void EnsureTransformMatrixFacade() noexcept;
101
101
 
102
102
  winrt::IInspectable EnsureUiaProvider() noexcept override;
103
- std::optional<std::string> getAcccessiblityValue() noexcept override;
103
+ std::optional<std::string> getAccessiblityValue() noexcept override;
104
104
  void setAcccessiblityValue(std::string &&value) noexcept override;
105
105
  bool getAcccessiblityIsReadOnly() noexcept override;
106
106
  ToggleState getToggleState() noexcept override;