react-native-windows 0.81.1 → 0.81.3
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.
- package/Libraries/Components/Pressable/Pressable.d.ts +8 -0
- package/Libraries/Components/Pressable/Pressable.windows.js +21 -2
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +26 -0
- package/Microsoft.ReactNative/Fabric/ComponentView.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.cpp +2 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.h +1 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +65 -32
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +9 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +8 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.cpp +4 -7
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.h +1 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp +68 -53
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.h +1 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +18 -14
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +10 -3
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +30 -8
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +3 -2
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +550 -4
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +52 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +8 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +53 -2
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +8 -1
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +3 -1
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +6 -0
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +28 -10
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +1 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.h +2 -1
- package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +8 -0
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -0
- package/Microsoft.ReactNative/Utils/IcuUtils.cpp +84 -0
- package/Microsoft.ReactNative/Utils/IcuUtils.h +42 -0
- package/Microsoft.ReactNative.Cxx/StructInfo.h +8 -1
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/Shared/Shared.vcxitems +1 -0
- package/Shared/Shared.vcxitems.filters +1 -0
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +14 -0
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +14 -0
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +14 -0
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +14 -0
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +14 -0
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +14 -0
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +14 -0
- package/codegen/react/components/rnwcore/InputAccessory.g.h +14 -0
- package/codegen/react/components/rnwcore/ModalHostView.g.h +14 -0
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +14 -0
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +14 -0
- package/codegen/react/components/rnwcore/Switch.g.h +14 -0
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +14 -0
- package/codegen/react/components/rnwcore/VirtualView.g.h +14 -0
- package/package.json +4 -4
|
@@ -227,6 +227,14 @@ void ReactCompositionViewComponentBuilder::SetUnmountChildComponentViewHandler(
|
|
|
227
227
|
m_unmountChildComponentViewHandler = impl;
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
+
void ReactCompositionViewComponentBuilder::SetCreateAutomationPeerHandler(CreateAutomationPeerDelegate impl) noexcept {
|
|
231
|
+
m_createAutomationPeerHandler = impl;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const CreateAutomationPeerDelegate &ReactCompositionViewComponentBuilder::CreateAutomationPeerHandler() const noexcept {
|
|
235
|
+
return m_createAutomationPeerHandler;
|
|
236
|
+
}
|
|
237
|
+
|
|
230
238
|
const UnmountChildComponentViewDelegate &ReactCompositionViewComponentBuilder::UnmountChildComponentViewHandler()
|
|
231
239
|
const noexcept {
|
|
232
240
|
return m_unmountChildComponentViewHandler;
|
|
@@ -39,6 +39,7 @@ struct ReactCompositionViewComponentBuilder
|
|
|
39
39
|
void SetUpdateEventEmitterHandler(UpdateEventEmitterDelegate impl) noexcept;
|
|
40
40
|
void SetMountChildComponentViewHandler(MountChildComponentViewDelegate impl) noexcept;
|
|
41
41
|
void SetUnmountChildComponentViewHandler(UnmountChildComponentViewDelegate impl) noexcept;
|
|
42
|
+
void SetCreateAutomationPeerHandler(CreateAutomationPeerDelegate impl) noexcept;
|
|
42
43
|
|
|
43
44
|
public: // Composition::IReactCompositionViewComponentBuilder
|
|
44
45
|
void SetViewComponentViewInitializer(const ViewComponentViewInitializer &initializer) noexcept;
|
|
@@ -77,6 +78,7 @@ struct ReactCompositionViewComponentBuilder
|
|
|
77
78
|
const CreateVisualDelegate &CreateVisualHandler() const noexcept;
|
|
78
79
|
const winrt::Microsoft::ReactNative::Composition::Experimental::IVisualToMountChildrenIntoDelegate &
|
|
79
80
|
VisualToMountChildrenIntoHandler() const noexcept;
|
|
81
|
+
const CreateAutomationPeerDelegate &CreateAutomationPeerHandler() const noexcept;
|
|
80
82
|
|
|
81
83
|
private:
|
|
82
84
|
void InitializeComponentView(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept;
|
|
@@ -103,6 +105,7 @@ struct ReactCompositionViewComponentBuilder
|
|
|
103
105
|
winrt::Microsoft::ReactNative::UpdateEventEmitterDelegate m_updateEventEmitterHandler;
|
|
104
106
|
winrt::Microsoft::ReactNative::MountChildComponentViewDelegate m_mountChildComponentViewHandler;
|
|
105
107
|
winrt::Microsoft::ReactNative::UnmountChildComponentViewDelegate m_unmountChildComponentViewHandler;
|
|
108
|
+
winrt::Microsoft::ReactNative::CreateAutomationPeerDelegate m_createAutomationPeerHandler;
|
|
106
109
|
|
|
107
110
|
winrt::Microsoft::ReactNative::Composition::CreateVisualDelegate m_createVisualHandler;
|
|
108
111
|
winrt::Microsoft::ReactNative::Composition::Experimental::IVisualToMountChildrenIntoDelegate
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
#include <Fabric/FabricUIManagerModule.h>
|
|
10
10
|
#include <winrt/Microsoft.UI.Input.h>
|
|
11
|
+
#include "CompositionDynamicAutomationProvider.h"
|
|
11
12
|
#include "CompositionRootAutomationProvider.h"
|
|
13
|
+
#include "ContentIslandComponentView.h"
|
|
14
|
+
#include "ParagraphComponentView.h"
|
|
12
15
|
#include "ReactNativeIsland.h"
|
|
13
16
|
#include "Theme.h"
|
|
14
17
|
|
|
@@ -275,7 +278,7 @@ facebook::react::Point RootComponentView::getClientOffset() const noexcept {
|
|
|
275
278
|
return {};
|
|
276
279
|
}
|
|
277
280
|
|
|
278
|
-
winrt::
|
|
281
|
+
winrt::IUnknown RootComponentView::UiaProviderFromPoint(const POINT &ptPixels, const POINT &ptScreen) noexcept {
|
|
279
282
|
facebook::react::Point ptDips{
|
|
280
283
|
static_cast<facebook::react::Float>(ptPixels.x) / m_layoutMetrics.pointScaleFactor,
|
|
281
284
|
static_cast<facebook::react::Float>(ptPixels.y) / m_layoutMetrics.pointScaleFactor};
|
|
@@ -295,7 +298,41 @@ winrt::IInspectable RootComponentView::UiaProviderFromPoint(const POINT &ptPixel
|
|
|
295
298
|
if (view == nullptr)
|
|
296
299
|
return nullptr;
|
|
297
300
|
|
|
298
|
-
|
|
301
|
+
auto uiaProvider =
|
|
302
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(view)->EnsureUiaProvider();
|
|
303
|
+
|
|
304
|
+
if (auto contentIsland =
|
|
305
|
+
view.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ContentIslandComponentView>()) {
|
|
306
|
+
if (contentIsland->InnerAutomationProvider()) {
|
|
307
|
+
if (auto childProvider = contentIsland->InnerAutomationProvider()->TryGetChildSiteLinkAutomationProvider()) {
|
|
308
|
+
// ChildProvider is the the automation provider from the ChildSiteLink. In the case of WinUI, this
|
|
309
|
+
// is a pointer to WinUI's internal CUIAHostWindow object.
|
|
310
|
+
// It seems odd, but even though this node doesn't behave as a fragment root in our case (the real fragment root
|
|
311
|
+
// is the RootComponentView's UIA provider), we still use its IRawElementProviderFragmentRoot -- just so
|
|
312
|
+
// we can do the ElementProviderFromPoint call. (this was recommended by the team who did the initial
|
|
313
|
+
// architecture work).
|
|
314
|
+
if (auto fragmentRoot = childProvider.try_as<IRawElementProviderFragmentRoot>()) {
|
|
315
|
+
com_ptr<IRawElementProviderFragment> frag;
|
|
316
|
+
// WinUI then does its own hitTest inside the XAML tree.
|
|
317
|
+
fragmentRoot->ElementProviderFromPoint(
|
|
318
|
+
ptScreen
|
|
319
|
+
.x, // Note since we're going through IRawElementProviderFragment the coordinates are in screen space.
|
|
320
|
+
ptScreen.y,
|
|
321
|
+
frag.put());
|
|
322
|
+
// We return the specific child provider(frag) when hosted XAML has an element
|
|
323
|
+
// under the cursor. This satisfies the UIA "element at point" contract and exposes
|
|
324
|
+
// the control’s patterns/properties. If the hosted tree finds nothing, we fall back
|
|
325
|
+
// to the RNW container’s provider (uiaProvider) to keep the island accessible.
|
|
326
|
+
// (A Microsoft_UI_Xaml!CUIAWrapper object)
|
|
327
|
+
if (frag) {
|
|
328
|
+
return frag.as<winrt::IUnknown>();
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return uiaProvider;
|
|
299
336
|
}
|
|
300
337
|
|
|
301
338
|
float RootComponentView::FontSizeMultiplier() const noexcept {
|
|
@@ -349,4 +386,18 @@ HWND RootComponentView::GetHwndForParenting() noexcept {
|
|
|
349
386
|
return base_type::GetHwndForParenting();
|
|
350
387
|
}
|
|
351
388
|
|
|
389
|
+
void RootComponentView::ClearCurrentTextSelection() noexcept {
|
|
390
|
+
if (auto view = m_viewWithTextSelection.view()) {
|
|
391
|
+
if (auto paragraphView = view.try_as<ParagraphComponentView>()) {
|
|
392
|
+
paragraphView->ClearSelection();
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
m_viewWithTextSelection =
|
|
396
|
+
::Microsoft::ReactNative::ReactTaggedView{winrt::Microsoft::ReactNative::ComponentView{nullptr}};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
void RootComponentView::SetViewWithTextSelection(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
400
|
+
m_viewWithTextSelection = ::Microsoft::ReactNative::ReactTaggedView{view};
|
|
401
|
+
}
|
|
402
|
+
|
|
352
403
|
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#pragma once
|
|
6
6
|
|
|
7
7
|
#include <Fabric/ComponentView.h>
|
|
8
|
+
#include <Fabric/ReactTaggedView.h>
|
|
8
9
|
#include <Microsoft.ReactNative.Cxx/ReactContext.h>
|
|
9
10
|
|
|
10
11
|
#include "CompositionViewComponentView.h"
|
|
@@ -64,7 +65,7 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
|
|
|
64
65
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
65
66
|
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept override;
|
|
66
67
|
|
|
67
|
-
winrt::Windows::Foundation::
|
|
68
|
+
winrt::Windows::Foundation::IUnknown UiaProviderFromPoint(const POINT &ptPixels, const POINT &ptScreen) noexcept;
|
|
68
69
|
|
|
69
70
|
RootComponentView(
|
|
70
71
|
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
@@ -86,6 +87,9 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
|
|
|
86
87
|
|
|
87
88
|
HWND GetHwndForParenting() noexcept override;
|
|
88
89
|
|
|
90
|
+
void ClearCurrentTextSelection() noexcept;
|
|
91
|
+
void SetViewWithTextSelection(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept;
|
|
92
|
+
|
|
89
93
|
private:
|
|
90
94
|
// should this be a ReactTaggedView? - It shouldn't actually matter since if the view is going away it should always
|
|
91
95
|
// be clearing its focus But being a reactTaggedView might make it easier to identify cases where that isn't
|
|
@@ -94,6 +98,9 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
|
|
|
94
98
|
winrt::weak_ref<winrt::Microsoft::ReactNative::ReactNativeIsland> m_wkRootView{nullptr};
|
|
95
99
|
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::PortalComponentView> m_wkPortal{nullptr};
|
|
96
100
|
bool m_visualAddedToIsland{false};
|
|
101
|
+
|
|
102
|
+
::Microsoft::ReactNative::ReactTaggedView m_viewWithTextSelection{
|
|
103
|
+
winrt::Microsoft::ReactNative::ComponentView{nullptr}};
|
|
97
104
|
};
|
|
98
105
|
|
|
99
106
|
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
#include "WindowsTextInputComponentView.h"
|
|
7
7
|
|
|
8
8
|
#include <AutoDraw.h>
|
|
9
|
-
#include <Fabric/Composition/CompositionDynamicAutomationProvider.h>
|
|
10
9
|
#include <Fabric/Composition/UiaHelpers.h>
|
|
11
10
|
#include <Fabric/platform/react/renderer/graphics/PlatformColorUtils.h>
|
|
12
11
|
#include <Utils/ThemeUtils.h>
|
|
@@ -1782,6 +1781,9 @@ WindowsTextInputComponentView::createVisual() noexcept {
|
|
|
1782
1781
|
LRESULT res;
|
|
1783
1782
|
winrt::check_hresult(m_textServices->TxSendMessage(EM_SETTEXTMODE, TM_PLAINTEXT, 0, &res));
|
|
1784
1783
|
|
|
1784
|
+
// Enable TSF support
|
|
1785
|
+
winrt::check_hresult(m_textServices->TxSendMessage(EM_SETEDITSTYLE, SES_USECTF, SES_USECTF, nullptr));
|
|
1786
|
+
|
|
1785
1787
|
m_caretVisual = m_compContext.CreateCaretVisual();
|
|
1786
1788
|
visual.InsertAt(m_caretVisual.InnerVisual(), 0);
|
|
1787
1789
|
m_caretVisual.IsVisible(false);
|
|
@@ -174,6 +174,12 @@ bool Theme::TryGetPlatformColor(const std::string &platformColor, winrt::Windows
|
|
|
174
174
|
return true;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
if (platformColor == "Highlight@40" && TryGetPlatformColor("Highlight", color)) {
|
|
178
|
+
color.A = static_cast<uint8_t>(static_cast<float>(color.A) * 0.4f);
|
|
179
|
+
m_colorCache[platformColor] = std::make_pair(true, color);
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
|
|
177
183
|
auto uiColor = s_uiColorTypes.find(platformColor);
|
|
178
184
|
if (uiColor != s_uiColorTypes.end()) {
|
|
179
185
|
auto uiSettings{winrt::Windows::UI::ViewManagement::UISettings()};
|
|
@@ -267,7 +267,7 @@ void TooltipTracker::ShowTooltip(const winrt::Microsoft::ReactNative::ComponentV
|
|
|
267
267
|
static_cast<int>((tm.width + tooltipHorizontalPadding + tooltipHorizontalPadding) * scaleFactor);
|
|
268
268
|
tooltipData->height = static_cast<int>((tm.height + tooltipTopPadding + tooltipBottomPadding) * scaleFactor);
|
|
269
269
|
|
|
270
|
-
POINT pt = {static_cast<LONG>(m_pos.X), static_cast<LONG>(m_pos.Y)};
|
|
270
|
+
POINT pt = {static_cast<LONG>(m_pos.X * scaleFactor), static_cast<LONG>(m_pos.Y * scaleFactor)};
|
|
271
271
|
ClientToScreen(parentHwnd, &pt);
|
|
272
272
|
|
|
273
273
|
RegisterTooltipWndClass();
|
|
@@ -513,27 +513,45 @@ ExpandCollapseState GetExpandCollapseState(const bool &expanded) noexcept {
|
|
|
513
513
|
}
|
|
514
514
|
|
|
515
515
|
void AddSelectionItemsToContainer(CompositionDynamicAutomationProvider *provider) noexcept {
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
if (!selectionContainer)
|
|
516
|
+
auto selectionContainerView = provider->GetSelectionContainer();
|
|
517
|
+
if (!selectionContainerView)
|
|
519
518
|
return;
|
|
520
|
-
|
|
519
|
+
|
|
520
|
+
auto selectionContainerCompView =
|
|
521
|
+
selectionContainerView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>();
|
|
522
|
+
if (!selectionContainerCompView)
|
|
523
|
+
return;
|
|
524
|
+
|
|
525
|
+
selectionContainerCompView->EnsureUiaProvider();
|
|
526
|
+
|
|
527
|
+
if (!selectionContainerCompView->InnerAutomationProvider())
|
|
528
|
+
return;
|
|
529
|
+
|
|
521
530
|
auto simpleProvider = static_cast<IRawElementProviderSimple *>(provider);
|
|
522
531
|
winrt::com_ptr<IRawElementProviderSimple> simpleProviderPtr;
|
|
523
532
|
simpleProviderPtr.copy_from(simpleProvider);
|
|
524
|
-
|
|
533
|
+
selectionContainerCompView->InnerAutomationProvider()->AddToSelectionItems(simpleProviderPtr);
|
|
525
534
|
}
|
|
526
535
|
|
|
527
536
|
void RemoveSelectionItemsFromContainer(CompositionDynamicAutomationProvider *provider) noexcept {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
if (!selectionContainer)
|
|
537
|
+
auto selectionContainerView = provider->GetSelectionContainer();
|
|
538
|
+
if (!selectionContainerView)
|
|
531
539
|
return;
|
|
532
|
-
|
|
540
|
+
|
|
541
|
+
auto selectionContainerCompView =
|
|
542
|
+
selectionContainerView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>();
|
|
543
|
+
if (!selectionContainerCompView)
|
|
544
|
+
return;
|
|
545
|
+
|
|
546
|
+
selectionContainerCompView->EnsureUiaProvider();
|
|
547
|
+
|
|
548
|
+
if (!selectionContainerCompView->InnerAutomationProvider())
|
|
549
|
+
return;
|
|
550
|
+
|
|
533
551
|
auto simpleProvider = static_cast<IRawElementProviderSimple *>(provider);
|
|
534
552
|
winrt::com_ptr<IRawElementProviderSimple> simpleProviderPtr;
|
|
535
553
|
simpleProviderPtr.copy_from(simpleProvider);
|
|
536
|
-
|
|
554
|
+
selectionContainerCompView->InnerAutomationProvider()->RemoveFromSelectionItems(simpleProviderPtr);
|
|
537
555
|
}
|
|
538
556
|
|
|
539
557
|
ToggleState GetToggleState(const std::optional<facebook::react::AccessibilityState> &state) noexcept {
|
|
@@ -16,7 +16,7 @@ namespace Microsoft::ReactNative {
|
|
|
16
16
|
*/
|
|
17
17
|
struct ReactTaggedView {
|
|
18
18
|
ReactTaggedView(const winrt::Microsoft::ReactNative::ComponentView &componentView)
|
|
19
|
-
: m_view(componentView), m_tag(componentView.Tag()) {}
|
|
19
|
+
: m_view(componentView), m_tag(componentView ? componentView.Tag() : -1) {}
|
|
20
20
|
|
|
21
21
|
winrt::Microsoft::ReactNative::ComponentView view() noexcept {
|
|
22
22
|
if (!m_view) {
|
|
@@ -56,8 +56,9 @@ class WindowsTextLayoutManager : public TextLayoutManager {
|
|
|
56
56
|
TextMeasurement::Attachments &attachments,
|
|
57
57
|
float minimumFontScale) noexcept;
|
|
58
58
|
|
|
59
|
-
private:
|
|
60
59
|
static winrt::hstring GetTransformedText(const AttributedStringBox &attributedStringBox);
|
|
60
|
+
|
|
61
|
+
private:
|
|
61
62
|
static void GetTextLayout(
|
|
62
63
|
const AttributedStringBox &attributedStringBox,
|
|
63
64
|
const ParagraphAttributes ¶graphAttributes,
|
|
@@ -54,6 +54,10 @@ namespace Microsoft.ReactNative
|
|
|
54
54
|
Boolean Handled;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
runtimeclass CreateAutomationPeerArgs {
|
|
58
|
+
Object DefaultAutomationPeer { get; };
|
|
59
|
+
};
|
|
60
|
+
|
|
57
61
|
[experimental]
|
|
58
62
|
DOC_STRING("A delegate that creates a @IComponentProps object for an instance of @ViewProps. See @IReactViewComponentBuilder.SetCreateProps")
|
|
59
63
|
delegate IComponentProps ViewPropsFactory(ViewProps props, IComponentProps cloneFrom);
|
|
@@ -95,6 +99,9 @@ namespace Microsoft.ReactNative
|
|
|
95
99
|
[experimental]
|
|
96
100
|
delegate void UnmountChildComponentViewDelegate(ComponentView source, UnmountChildComponentViewArgs args);
|
|
97
101
|
|
|
102
|
+
[experimental]
|
|
103
|
+
delegate Object CreateAutomationPeerDelegate(ComponentView source, CreateAutomationPeerArgs args);
|
|
104
|
+
|
|
98
105
|
[experimental]
|
|
99
106
|
runtimeclass EventEmitter {
|
|
100
107
|
void DispatchEvent(String eventName, JSValueArgWriter args);
|
|
@@ -124,6 +131,7 @@ namespace Microsoft.ReactNative
|
|
|
124
131
|
void SetUpdateEventEmitterHandler(UpdateEventEmitterDelegate impl);
|
|
125
132
|
void SetMountChildComponentViewHandler(MountChildComponentViewDelegate impl);
|
|
126
133
|
void SetUnmountChildComponentViewHandler(UnmountChildComponentViewDelegate impl);
|
|
134
|
+
void SetCreateAutomationPeerHandler(CreateAutomationPeerDelegate impl);
|
|
127
135
|
};
|
|
128
136
|
|
|
129
137
|
// [exclusiveto(ShadowNode)]
|
|
@@ -313,6 +313,7 @@
|
|
|
313
313
|
<ClInclude Include="Utils\TransformableText.h" />
|
|
314
314
|
<ClInclude Include="Utils\UwpPreparedScriptStore.h" />
|
|
315
315
|
<ClInclude Include="Utils\UwpScriptStore.h" />
|
|
316
|
+
<ClInclude Include="Utils\IcuUtils.h" />
|
|
316
317
|
<ClInclude Include="Utils\ValueUtils.h" />
|
|
317
318
|
<ClInclude Include="Utils\XamlIslandUtils.h" />
|
|
318
319
|
<ClInclude Include="Utils\XamlUtils.h" />
|
|
@@ -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{
|
|
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;
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.81.
|
|
13
|
+
<ReactNativeWindowsVersion>0.81.3</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>81</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>3</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>2c35b82f34d7821ca3d855c0bb51fb44d4d8c1df</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
package/Shared/Shared.vcxitems
CHANGED
|
@@ -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) {
|
|
@@ -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) {
|