react-native-windows 0.81.2 → 0.81.4

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 (66) hide show
  1. package/Libraries/Components/Pressable/Pressable.d.ts +8 -0
  2. package/Libraries/Components/Pressable/Pressable.windows.js +21 -2
  3. package/Microsoft.ReactNative/ABIViewManager.cpp +12 -1
  4. package/Microsoft.ReactNative/CompositionSwitcher.idl +16 -9
  5. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +26 -0
  6. package/Microsoft.ReactNative/Fabric/ComponentView.h +2 -0
  7. package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +0 -1
  8. package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.cpp +2 -5
  9. package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.h +1 -4
  10. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +15 -0
  11. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +65 -32
  12. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +9 -0
  13. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +8 -0
  14. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +2 -1
  15. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.cpp +4 -7
  16. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.h +1 -5
  17. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp +68 -53
  18. package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.h +1 -5
  19. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +98 -15
  20. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +10 -3
  21. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +73 -10
  22. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +11 -1
  23. package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +3 -2
  24. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +0 -1
  25. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +609 -4
  26. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +63 -0
  27. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +8 -0
  28. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +3 -0
  29. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +53 -2
  30. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +8 -1
  31. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +0 -1
  32. package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +0 -1
  33. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +3 -1
  34. package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +6 -0
  35. package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +1 -1
  36. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +36 -14
  37. package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +0 -1
  38. package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +1 -1
  39. package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.h +2 -1
  40. package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +8 -0
  41. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -0
  42. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +41 -15
  43. package/Microsoft.ReactNative/Utils/IcuUtils.cpp +84 -0
  44. package/Microsoft.ReactNative/Utils/IcuUtils.h +42 -0
  45. package/Microsoft.ReactNative.Cxx/StructInfo.h +8 -1
  46. package/Mso/src/dispatchQueue/queueService.cpp +3 -1
  47. package/Mso/src/dispatchQueue/uiScheduler_winrt.cpp +2 -1
  48. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  49. package/Shared/Networking/OriginPolicyHttpFilter.cpp +2 -1
  50. package/Shared/Shared.vcxitems +1 -0
  51. package/Shared/Shared.vcxitems.filters +1 -0
  52. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +14 -0
  53. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +34 -20
  54. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +14 -0
  55. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +14 -0
  56. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +18 -4
  57. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +18 -4
  58. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +14 -0
  59. package/codegen/react/components/rnwcore/InputAccessory.g.h +14 -0
  60. package/codegen/react/components/rnwcore/ModalHostView.g.h +32 -18
  61. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +18 -4
  62. package/codegen/react/components/rnwcore/SafeAreaView.g.h +14 -0
  63. package/codegen/react/components/rnwcore/Switch.g.h +18 -4
  64. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +14 -0
  65. package/codegen/react/components/rnwcore/VirtualView.g.h +48 -6
  66. package/package.json +3 -3
@@ -0,0 +1,84 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "pch.h"
5
+ #include "IcuUtils.h"
6
+ #include <icu.h>
7
+
8
+ namespace Microsoft::ReactNative::IcuUtils {
9
+
10
+ void UBreakIteratorDeleter::operator()(void *ptr) const noexcept {
11
+ if (ptr) {
12
+ ubrk_close(static_cast<UBreakIterator *>(ptr));
13
+ }
14
+ }
15
+
16
+ WordBreakIterator::WordBreakIterator(const wchar_t *text, int32_t length) noexcept : m_length(length) {
17
+ UErrorCode status = U_ZERO_ERROR;
18
+ auto *iter = ubrk_open(UBRK_WORD, nullptr, reinterpret_cast<const UChar *>(text), length, &status);
19
+ if (U_SUCCESS(status)) {
20
+ m_breakIterator.reset(static_cast<void *>(iter));
21
+ }
22
+ }
23
+
24
+ bool WordBreakIterator::IsValid() const noexcept {
25
+ return m_breakIterator != nullptr;
26
+ }
27
+
28
+ bool WordBreakIterator::GetWordBoundaries(int32_t position, int32_t &outStart, int32_t &outEnd) const noexcept {
29
+ if (!m_breakIterator || position < 0 || position >= m_length) {
30
+ return false;
31
+ }
32
+
33
+ auto *iter = static_cast<UBreakIterator *>(m_breakIterator.get());
34
+
35
+ int32_t start = ubrk_preceding(iter, position + 1);
36
+ if (start == UBRK_DONE) {
37
+ start = 0;
38
+ }
39
+
40
+ int32_t end = ubrk_following(iter, position);
41
+ if (end == UBRK_DONE) {
42
+ end = m_length;
43
+ }
44
+
45
+ int32_t ruleStatus = ubrk_getRuleStatus(iter);
46
+ if (ruleStatus == UBRK_WORD_NONE) {
47
+ return false;
48
+ }
49
+
50
+ outStart = start;
51
+ outEnd = end;
52
+ return true;
53
+ }
54
+
55
+ bool IsAlphanumeric(UChar32 codePoint) noexcept {
56
+ return u_isalnum(codePoint) != 0;
57
+ }
58
+
59
+ UChar32 GetCodePointAt(const wchar_t *str, int32_t length, int32_t pos) noexcept {
60
+ if (!str || length <= 0 || pos < 0 || pos >= length) {
61
+ return 0;
62
+ }
63
+ UChar32 cp;
64
+ U16_GET(str, 0, pos, length, cp);
65
+ return cp;
66
+ }
67
+
68
+ int32_t MoveToPreviousCodePoint(const wchar_t *str, int32_t pos) noexcept {
69
+ if (!str || pos <= 0) {
70
+ return 0;
71
+ }
72
+ U16_BACK_1(str, 0, pos);
73
+ return pos;
74
+ }
75
+
76
+ int32_t MoveToNextCodePoint(const wchar_t *str, int32_t length, int32_t pos) noexcept {
77
+ if (!str || length <= 0 || pos >= length) {
78
+ return length;
79
+ }
80
+ U16_FWD_1(str, pos, length);
81
+ return pos;
82
+ }
83
+
84
+ } // namespace Microsoft::ReactNative::IcuUtils
@@ -0,0 +1,42 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+
6
+ #include <cstdint>
7
+ #include <memory>
8
+
9
+ // ICU utilities wrapped in a namespace to avoid UChar naming conflicts with Folly's FBString.
10
+ // Folly has a template parameter named 'UChar' which conflicts with ICU's global UChar typedef.
11
+ namespace Microsoft::ReactNative::IcuUtils {
12
+
13
+ using UChar32 = int32_t;
14
+
15
+ struct UBreakIteratorDeleter {
16
+ void operator()(void *ptr) const noexcept;
17
+ };
18
+
19
+ class WordBreakIterator {
20
+ public:
21
+ WordBreakIterator(const wchar_t *text, int32_t length) noexcept;
22
+
23
+ WordBreakIterator(const WordBreakIterator &) = delete;
24
+ WordBreakIterator &operator=(const WordBreakIterator &) = delete;
25
+ WordBreakIterator(WordBreakIterator &&) = default;
26
+ WordBreakIterator &operator=(WordBreakIterator &&) = default;
27
+
28
+ bool IsValid() const noexcept;
29
+
30
+ bool GetWordBoundaries(int32_t position, int32_t &outStart, int32_t &outEnd) const noexcept;
31
+
32
+ private:
33
+ std::unique_ptr<void, UBreakIteratorDeleter> m_breakIterator{nullptr};
34
+ int32_t m_length = 0;
35
+ };
36
+
37
+ bool IsAlphanumeric(UChar32 codePoint) noexcept;
38
+ UChar32 GetCodePointAt(const wchar_t *str, int32_t length, int32_t pos) noexcept;
39
+ int32_t MoveToPreviousCodePoint(const wchar_t *str, int32_t pos) noexcept;
40
+ int32_t MoveToNextCodePoint(const wchar_t *str, int32_t length, int32_t pos) noexcept;
41
+
42
+ } // namespace Microsoft::ReactNative::IcuUtils
@@ -81,7 +81,7 @@ struct FieldInfo {
81
81
  FieldInfo(TValue TClass::*fieldPtr) noexcept
82
82
  : m_fieldReader{FieldReader<TClass, TValue>},
83
83
  m_fieldWriter{FieldWriter<TClass, TValue>},
84
- m_fieldPtrStore{*reinterpret_cast<uintptr_t *>(&fieldPtr)} {
84
+ m_fieldPtrStore{StoreFieldPtr(fieldPtr)} {
85
85
  static_assert(sizeof(m_fieldPtrStore) >= sizeof(fieldPtr));
86
86
  }
87
87
 
@@ -94,6 +94,13 @@ struct FieldInfo {
94
94
  }
95
95
 
96
96
  private:
97
+ template <class TClass, class TValue>
98
+ static uintptr_t StoreFieldPtr(TValue TClass::*fieldPtr) noexcept {
99
+ uintptr_t result{};
100
+ std::memcpy(&result, &fieldPtr, sizeof(fieldPtr));
101
+ return result;
102
+ }
103
+
97
104
  FieldReaderType m_fieldReader;
98
105
  FieldWriterType m_fieldWriter;
99
106
  const uintptr_t m_fieldPtrStore;
@@ -205,8 +205,10 @@ void QueueService::InvokeTask(
205
205
  DispatchTask taskToInvoke{std::move(task)};
206
206
  taskToInvoke.Get()->Invoke(); // Call Get()->Invoke instead of operator() to flatten call stack
207
207
 
208
- while (taskToInvoke = context.TakeNextDeferredTask()) {
208
+ taskToInvoke = context.TakeNextDeferredTask();
209
+ while (taskToInvoke) {
209
210
  taskToInvoke.Get()->Invoke();
211
+ taskToInvoke = context.TakeNextDeferredTask();
210
212
  }
211
213
  }
212
214
 
@@ -271,7 +271,8 @@ bool UISchedulerWinRT<TDispatcherTraits>::TryTakeTask(
271
271
  --m_taskCount;
272
272
  }
273
273
 
274
- if (queue = m_queue.GetStrongPtr()) {
274
+ queue = m_queue.GetStrongPtr();
275
+ if (queue) {
275
276
  return queue->TryDequeTask(task);
276
277
  }
277
278
 
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.81.2</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.81.4</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>81</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>2</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>4</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>2589a216e30d0edb9b2be922ba8b5a3fb6ce2591</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>6cfb66be9b4dbbdff53e896e215230cdeddc38a6</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -758,7 +758,8 @@ ResponseOperation OriginPolicyHttpFilter::SendRequestAsync(HttpRequestMessage co
758
758
  if (originPolicy == OriginPolicy::CrossOriginResourceSharing) {
759
759
  // If inner filter can AllowRedirect, disable for preflight.
760
760
  winrt::impl::com_ref<IHttpBaseProtocolFilter> baseFilter;
761
- if (baseFilter = m_innerFilter.try_as<IHttpBaseProtocolFilter>()) {
761
+ baseFilter = m_innerFilter.try_as<IHttpBaseProtocolFilter>();
762
+ if (baseFilter) {
762
763
  baseFilter.AllowAutoRedirect(false);
763
764
  }
764
765
 
@@ -519,6 +519,7 @@
519
519
  <ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\RedBoxErrorInfo.cpp" />
520
520
  <ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\TurboModulesProvider.cpp" />
521
521
  <ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Utils\Helpers.cpp" />
522
+ <ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Utils\IcuUtils.cpp" />
522
523
  <ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Utils\ImageUtils.cpp" />
523
524
  <ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Utils\ThemeUtils.cpp" />
524
525
  <ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Views\DevMenu.cpp" />
@@ -105,6 +105,7 @@
105
105
  <Filter>Source Files\Modules</Filter>
106
106
  </ClCompile>
107
107
  <ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Utils\ImageUtils.cpp" />
108
+ <ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Utils\IcuUtils.cpp" />
108
109
  <ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Utils\Helpers.cpp" />
109
110
  <ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Views\DevMenu.cpp" />
110
111
  <ClCompile Include="$(MSBuildThisFileDirectory)..\codegen\react\components\rnwcore\EventEmitters.cpp">
@@ -110,6 +110,12 @@ struct BaseActivityIndicatorView {
110
110
  winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
111
111
  }
112
112
 
113
+ // CreateAutomationPeer will only be called if this method is overridden
114
+ virtual winrt::Windows::Foundation::IInspectable CreateAutomationPeer(const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
115
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& /*args*/) noexcept {
116
+ return nullptr;
117
+ }
118
+
113
119
 
114
120
 
115
121
  const std::shared_ptr<ActivityIndicatorViewEventEmitter>& EventEmitter() const { return m_eventEmitter; }
@@ -185,6 +191,14 @@ void RegisterActivityIndicatorViewNativeComponent(
185
191
  });
186
192
  }
187
193
 
194
+ if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::CreateAutomationPeer != &BaseActivityIndicatorView<TUserData>::CreateAutomationPeer) {
195
+ builder.SetCreateAutomationPeerHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
196
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& args) noexcept {
197
+ auto userData = view.UserData().as<TUserData>();
198
+ return userData->CreateAutomationPeer(view, args);
199
+ });
200
+ }
201
+
188
202
  compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
189
203
  auto userData = winrt::make_self<TUserData>();
190
204
  if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::Initialize != &BaseActivityIndicatorView<TUserData>::Initialize) {
@@ -59,55 +59,55 @@ struct AndroidDrawerLayoutProps : winrt::implements<AndroidDrawerLayoutProps, wi
59
59
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
60
60
  };
61
61
 
62
- REACT_STRUCT(AndroidDrawerLayout_OnDrawerSlide)
63
- struct AndroidDrawerLayout_OnDrawerSlide {
64
- REACT_FIELD(offset)
65
- float offset{};
62
+ REACT_STRUCT(AndroidDrawerLayoutSpec_onDrawerClose)
63
+ struct AndroidDrawerLayoutSpec_onDrawerClose {
66
64
  };
67
65
 
68
- REACT_STRUCT(AndroidDrawerLayout_OnDrawerStateChanged)
69
- struct AndroidDrawerLayout_OnDrawerStateChanged {
70
- REACT_FIELD(drawerState)
71
- int32_t drawerState{};
66
+ REACT_STRUCT(AndroidDrawerLayoutSpec_onDrawerOpen)
67
+ struct AndroidDrawerLayoutSpec_onDrawerOpen {
72
68
  };
73
69
 
74
- REACT_STRUCT(AndroidDrawerLayout_OnDrawerOpen)
75
- struct AndroidDrawerLayout_OnDrawerOpen {
70
+ REACT_STRUCT(AndroidDrawerLayoutSpec_onDrawerStateChanged)
71
+ struct AndroidDrawerLayoutSpec_onDrawerStateChanged {
72
+ REACT_FIELD(drawerState)
73
+ int32_t drawerState{};
76
74
  };
77
75
 
78
- REACT_STRUCT(AndroidDrawerLayout_OnDrawerClose)
79
- struct AndroidDrawerLayout_OnDrawerClose {
76
+ REACT_STRUCT(AndroidDrawerLayoutSpec_onDrawerSlide)
77
+ struct AndroidDrawerLayoutSpec_onDrawerSlide {
78
+ REACT_FIELD(offset)
79
+ float offset{};
80
80
  };
81
81
 
82
82
  struct AndroidDrawerLayoutEventEmitter {
83
83
  AndroidDrawerLayoutEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
84
84
  : m_eventEmitter(eventEmitter) {}
85
85
 
86
- using OnDrawerSlide = AndroidDrawerLayout_OnDrawerSlide;
87
- using OnDrawerStateChanged = AndroidDrawerLayout_OnDrawerStateChanged;
88
- using OnDrawerOpen = AndroidDrawerLayout_OnDrawerOpen;
89
- using OnDrawerClose = AndroidDrawerLayout_OnDrawerClose;
86
+ using OnDrawerSlide = AndroidDrawerLayoutSpec_onDrawerSlide;
87
+ using OnDrawerStateChanged = AndroidDrawerLayoutSpec_onDrawerStateChanged;
88
+ using OnDrawerOpen = AndroidDrawerLayoutSpec_onDrawerOpen;
89
+ using OnDrawerClose = AndroidDrawerLayoutSpec_onDrawerClose;
90
90
 
91
91
  void onDrawerSlide(OnDrawerSlide &value) const {
92
- m_eventEmitter.DispatchEvent(L"drawerSlide", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
92
+ m_eventEmitter.DispatchEvent(L"drawerSlide", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
93
93
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
94
94
  });
95
95
  }
96
96
 
97
97
  void onDrawerStateChanged(OnDrawerStateChanged &value) const {
98
- m_eventEmitter.DispatchEvent(L"drawerStateChanged", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
98
+ m_eventEmitter.DispatchEvent(L"drawerStateChanged", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
99
99
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
100
100
  });
101
101
  }
102
102
 
103
103
  void onDrawerOpen(OnDrawerOpen &value) const {
104
- m_eventEmitter.DispatchEvent(L"drawerOpen", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
104
+ m_eventEmitter.DispatchEvent(L"drawerOpen", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
105
105
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
106
106
  });
107
107
  }
108
108
 
109
109
  void onDrawerClose(OnDrawerClose &value) const {
110
- m_eventEmitter.DispatchEvent(L"drawerClose", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
110
+ m_eventEmitter.DispatchEvent(L"drawerClose", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
111
111
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
112
112
  });
113
113
  }
@@ -167,6 +167,12 @@ struct BaseAndroidDrawerLayout {
167
167
  winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
168
168
  }
169
169
 
170
+ // CreateAutomationPeer will only be called if this method is overridden
171
+ virtual winrt::Windows::Foundation::IInspectable CreateAutomationPeer(const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
172
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& /*args*/) noexcept {
173
+ return nullptr;
174
+ }
175
+
170
176
  // You must provide an implementation of this method to handle the "openDrawer" command
171
177
  virtual void HandleOpenDrawerCommand() noexcept = 0;
172
178
 
@@ -268,6 +274,14 @@ void RegisterAndroidDrawerLayoutNativeComponent(
268
274
  });
269
275
  }
270
276
 
277
+ if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::CreateAutomationPeer != &BaseAndroidDrawerLayout<TUserData>::CreateAutomationPeer) {
278
+ builder.SetCreateAutomationPeerHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
279
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& args) noexcept {
280
+ auto userData = view.UserData().as<TUserData>();
281
+ return userData->CreateAutomationPeer(view, args);
282
+ });
283
+ }
284
+
271
285
  compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
272
286
  auto userData = winrt::make_self<TUserData>();
273
287
  if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::Initialize != &BaseAndroidDrawerLayout<TUserData>::Initialize) {
@@ -98,6 +98,12 @@ struct BaseAndroidHorizontalScrollContentView {
98
98
  winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
99
99
  }
100
100
 
101
+ // CreateAutomationPeer will only be called if this method is overridden
102
+ virtual winrt::Windows::Foundation::IInspectable CreateAutomationPeer(const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
103
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& /*args*/) noexcept {
104
+ return nullptr;
105
+ }
106
+
101
107
 
102
108
 
103
109
  const std::shared_ptr<AndroidHorizontalScrollContentViewEventEmitter>& EventEmitter() const { return m_eventEmitter; }
@@ -173,6 +179,14 @@ void RegisterAndroidHorizontalScrollContentViewNativeComponent(
173
179
  });
174
180
  }
175
181
 
182
+ if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::CreateAutomationPeer != &BaseAndroidHorizontalScrollContentView<TUserData>::CreateAutomationPeer) {
183
+ builder.SetCreateAutomationPeerHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
184
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& args) noexcept {
185
+ auto userData = view.UserData().as<TUserData>();
186
+ return userData->CreateAutomationPeer(view, args);
187
+ });
188
+ }
189
+
176
190
  compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
177
191
  auto userData = winrt::make_self<TUserData>();
178
192
  if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::Initialize != &BaseAndroidHorizontalScrollContentView<TUserData>::Initialize) {
@@ -122,6 +122,12 @@ struct BaseAndroidProgressBar {
122
122
  winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
123
123
  }
124
124
 
125
+ // CreateAutomationPeer will only be called if this method is overridden
126
+ virtual winrt::Windows::Foundation::IInspectable CreateAutomationPeer(const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
127
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& /*args*/) noexcept {
128
+ return nullptr;
129
+ }
130
+
125
131
 
126
132
 
127
133
  const std::shared_ptr<AndroidProgressBarEventEmitter>& EventEmitter() const { return m_eventEmitter; }
@@ -197,6 +203,14 @@ void RegisterAndroidProgressBarNativeComponent(
197
203
  });
198
204
  }
199
205
 
206
+ if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::CreateAutomationPeer != &BaseAndroidProgressBar<TUserData>::CreateAutomationPeer) {
207
+ builder.SetCreateAutomationPeerHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
208
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& args) noexcept {
209
+ auto userData = view.UserData().as<TUserData>();
210
+ return userData->CreateAutomationPeer(view, args);
211
+ });
212
+ }
213
+
200
214
  compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
201
215
  auto userData = winrt::make_self<TUserData>();
202
216
  if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::Initialize != &BaseAndroidProgressBar<TUserData>::Initialize) {
@@ -59,18 +59,18 @@ struct AndroidSwipeRefreshLayoutProps : winrt::implements<AndroidSwipeRefreshLay
59
59
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
60
60
  };
61
61
 
62
- REACT_STRUCT(AndroidSwipeRefreshLayout_OnRefresh)
63
- struct AndroidSwipeRefreshLayout_OnRefresh {
62
+ REACT_STRUCT(AndroidSwipeRefreshLayoutSpec_onRefresh)
63
+ struct AndroidSwipeRefreshLayoutSpec_onRefresh {
64
64
  };
65
65
 
66
66
  struct AndroidSwipeRefreshLayoutEventEmitter {
67
67
  AndroidSwipeRefreshLayoutEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
68
68
  : m_eventEmitter(eventEmitter) {}
69
69
 
70
- using OnRefresh = AndroidSwipeRefreshLayout_OnRefresh;
70
+ using OnRefresh = AndroidSwipeRefreshLayoutSpec_onRefresh;
71
71
 
72
72
  void onRefresh(OnRefresh &value) const {
73
- m_eventEmitter.DispatchEvent(L"refresh", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
73
+ m_eventEmitter.DispatchEvent(L"refresh", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
74
74
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
75
75
  });
76
76
  }
@@ -130,6 +130,12 @@ struct BaseAndroidSwipeRefreshLayout {
130
130
  winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
131
131
  }
132
132
 
133
+ // CreateAutomationPeer will only be called if this method is overridden
134
+ virtual winrt::Windows::Foundation::IInspectable CreateAutomationPeer(const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
135
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& /*args*/) noexcept {
136
+ return nullptr;
137
+ }
138
+
133
139
  // You must provide an implementation of this method to handle the "setNativeRefreshing" command
134
140
  virtual void HandleSetNativeRefreshingCommand(bool value) noexcept = 0;
135
141
 
@@ -223,6 +229,14 @@ void RegisterAndroidSwipeRefreshLayoutNativeComponent(
223
229
  });
224
230
  }
225
231
 
232
+ if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::CreateAutomationPeer != &BaseAndroidSwipeRefreshLayout<TUserData>::CreateAutomationPeer) {
233
+ builder.SetCreateAutomationPeerHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
234
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& args) noexcept {
235
+ auto userData = view.UserData().as<TUserData>();
236
+ return userData->CreateAutomationPeer(view, args);
237
+ });
238
+ }
239
+
226
240
  compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
227
241
  auto userData = winrt::make_self<TUserData>();
228
242
  if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::Initialize != &BaseAndroidSwipeRefreshLayout<TUserData>::Initialize) {
@@ -71,8 +71,8 @@ struct AndroidSwitchProps : winrt::implements<AndroidSwitchProps, winrt::Microso
71
71
  const winrt::Microsoft::ReactNative::ViewProps ViewProps;
72
72
  };
73
73
 
74
- REACT_STRUCT(AndroidSwitch_OnChange)
75
- struct AndroidSwitch_OnChange {
74
+ REACT_STRUCT(AndroidSwitchSpec_onChange)
75
+ struct AndroidSwitchSpec_onChange {
76
76
  REACT_FIELD(value)
77
77
  bool value{};
78
78
 
@@ -84,10 +84,10 @@ struct AndroidSwitchEventEmitter {
84
84
  AndroidSwitchEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
85
85
  : m_eventEmitter(eventEmitter) {}
86
86
 
87
- using OnChange = AndroidSwitch_OnChange;
87
+ using OnChange = AndroidSwitchSpec_onChange;
88
88
 
89
89
  void onChange(OnChange &value) const {
90
- m_eventEmitter.DispatchEvent(L"change", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
90
+ m_eventEmitter.DispatchEvent(L"change", [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
91
91
  winrt::Microsoft::ReactNative::WriteValue(writer, value);
92
92
  });
93
93
  }
@@ -147,6 +147,12 @@ struct BaseAndroidSwitch {
147
147
  winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
148
148
  }
149
149
 
150
+ // CreateAutomationPeer will only be called if this method is overridden
151
+ virtual winrt::Windows::Foundation::IInspectable CreateAutomationPeer(const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
152
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& /*args*/) noexcept {
153
+ return nullptr;
154
+ }
155
+
150
156
  // You must provide an implementation of this method to handle the "setNativeValue" command
151
157
  virtual void HandleSetNativeValueCommand(bool value) noexcept = 0;
152
158
 
@@ -240,6 +246,14 @@ void RegisterAndroidSwitchNativeComponent(
240
246
  });
241
247
  }
242
248
 
249
+ if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::CreateAutomationPeer != &BaseAndroidSwitch<TUserData>::CreateAutomationPeer) {
250
+ builder.SetCreateAutomationPeerHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
251
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& args) noexcept {
252
+ auto userData = view.UserData().as<TUserData>();
253
+ return userData->CreateAutomationPeer(view, args);
254
+ });
255
+ }
256
+
243
257
  compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
244
258
  auto userData = winrt::make_self<TUserData>();
245
259
  if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::Initialize != &BaseAndroidSwitch<TUserData>::Initialize) {
@@ -95,6 +95,12 @@ struct BaseDebuggingOverlay {
95
95
  winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
96
96
  }
97
97
 
98
+ // CreateAutomationPeer will only be called if this method is overridden
99
+ virtual winrt::Windows::Foundation::IInspectable CreateAutomationPeer(const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
100
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& /*args*/) noexcept {
101
+ return nullptr;
102
+ }
103
+
98
104
  // You must provide an implementation of this method to handle the "highlightTraceUpdates" command
99
105
  virtual void HandleHighlightTraceUpdatesCommand(std::vector<winrt::Microsoft::ReactNative::JSValue> updates) noexcept = 0;
100
106
 
@@ -207,6 +213,14 @@ void RegisterDebuggingOverlayNativeComponent(
207
213
  });
208
214
  }
209
215
 
216
+ if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::CreateAutomationPeer != &BaseDebuggingOverlay<TUserData>::CreateAutomationPeer) {
217
+ builder.SetCreateAutomationPeerHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
218
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& args) noexcept {
219
+ auto userData = view.UserData().as<TUserData>();
220
+ return userData->CreateAutomationPeer(view, args);
221
+ });
222
+ }
223
+
210
224
  compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
211
225
  auto userData = winrt::make_self<TUserData>();
212
226
  if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::Initialize != &BaseDebuggingOverlay<TUserData>::Initialize) {
@@ -98,6 +98,12 @@ struct BaseInputAccessory {
98
98
  winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
99
99
  }
100
100
 
101
+ // CreateAutomationPeer will only be called if this method is overridden
102
+ virtual winrt::Windows::Foundation::IInspectable CreateAutomationPeer(const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
103
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& /*args*/) noexcept {
104
+ return nullptr;
105
+ }
106
+
101
107
 
102
108
 
103
109
  const std::shared_ptr<InputAccessoryEventEmitter>& EventEmitter() const { return m_eventEmitter; }
@@ -173,6 +179,14 @@ void RegisterInputAccessoryNativeComponent(
173
179
  });
174
180
  }
175
181
 
182
+ if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::CreateAutomationPeer != &BaseInputAccessory<TUserData>::CreateAutomationPeer) {
183
+ builder.SetCreateAutomationPeerHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
184
+ const winrt::Microsoft::ReactNative::CreateAutomationPeerArgs& args) noexcept {
185
+ auto userData = view.UserData().as<TUserData>();
186
+ return userData->CreateAutomationPeer(view, args);
187
+ });
188
+ }
189
+
176
190
  compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
177
191
  auto userData = winrt::make_self<TUserData>();
178
192
  if CONSTEXPR_SUPPORTED_ON_VIRTUAL_FN_ADDRESS (&TUserData::Initialize != &BaseInputAccessory<TUserData>::Initialize) {