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.
- package/Libraries/Components/Pressable/Pressable.d.ts +8 -0
- package/Libraries/Components/Pressable/Pressable.windows.js +21 -2
- package/Microsoft.ReactNative/ABIViewManager.cpp +12 -1
- package/Microsoft.ReactNative/CompositionSwitcher.idl +16 -9
- 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/CompositionContextHelper.cpp +15 -0
- 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 +98 -15
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +10 -3
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +73 -10
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +11 -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 +609 -4
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +63 -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 +36 -14
- 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/Modules/ImageViewManagerModule.cpp +41 -15
- 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/Mso/src/dispatchQueue/queueService.cpp +3 -1
- package/Mso/src/dispatchQueue/uiScheduler_winrt.cpp +2 -1
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/Shared/Networking/OriginPolicyHttpFilter.cpp +2 -1
- 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 +34 -20
- 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 +18 -4
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +18 -4
- 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 +32 -18
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +18 -4
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +14 -0
- package/codegen/react/components/rnwcore/Switch.g.h +18 -4
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +14 -0
- package/codegen/react/components/rnwcore/VirtualView.g.h +48 -6
- package/package.json +3 -3
|
@@ -120,6 +120,14 @@ export interface PressableProps
|
|
|
120
120
|
*/
|
|
121
121
|
disabled?: null | boolean | undefined;
|
|
122
122
|
|
|
123
|
+
//[ Windows
|
|
124
|
+
/**
|
|
125
|
+
* When the pressable is pressed it will take focus
|
|
126
|
+
* Default value: true
|
|
127
|
+
*/
|
|
128
|
+
focusOnPress?: null | boolean | undefined;
|
|
129
|
+
// Windows]
|
|
130
|
+
|
|
123
131
|
/**
|
|
124
132
|
* Additional distance outside of this view in which a press is detected.
|
|
125
133
|
*/
|
|
@@ -71,6 +71,14 @@ type PressableBaseProps = $ReadOnly<{
|
|
|
71
71
|
*/
|
|
72
72
|
disabled?: ?boolean,
|
|
73
73
|
|
|
74
|
+
// [Windows
|
|
75
|
+
/**
|
|
76
|
+
* When the pressable is pressed it will take focus
|
|
77
|
+
* Default value: true
|
|
78
|
+
*/
|
|
79
|
+
focusOnPress?: ?boolean,
|
|
80
|
+
// Windows]
|
|
81
|
+
|
|
74
82
|
/**
|
|
75
83
|
* Additional distance outside of this view in which a press is detected.
|
|
76
84
|
*/
|
|
@@ -238,6 +246,7 @@ function Pressable({
|
|
|
238
246
|
delayLongPress,
|
|
239
247
|
disabled,
|
|
240
248
|
focusable,
|
|
249
|
+
focusOnPress, // Windows
|
|
241
250
|
hitSlop,
|
|
242
251
|
onBlur,
|
|
243
252
|
onFocus,
|
|
@@ -309,6 +318,16 @@ function Pressable({
|
|
|
309
318
|
hitSlop,
|
|
310
319
|
};
|
|
311
320
|
|
|
321
|
+
const onPressWithFocus = React.useCallback(
|
|
322
|
+
(args: GestureResponderEvent) => {
|
|
323
|
+
if (focusable !== false && focusOnPress !== false) {
|
|
324
|
+
viewRef?.current?.focus();
|
|
325
|
+
}
|
|
326
|
+
onPress?.(args);
|
|
327
|
+
},
|
|
328
|
+
[focusOnPress, onPress, focusable],
|
|
329
|
+
);
|
|
330
|
+
|
|
312
331
|
const config = useMemo(
|
|
313
332
|
() => ({
|
|
314
333
|
cancelable,
|
|
@@ -325,7 +344,7 @@ function Pressable({
|
|
|
325
344
|
onHoverIn,
|
|
326
345
|
onHoverOut,
|
|
327
346
|
onLongPress,
|
|
328
|
-
onPress,
|
|
347
|
+
onPress: onPressWithFocus,
|
|
329
348
|
onPressIn(event: GestureResponderEvent): void {
|
|
330
349
|
if (android_rippleConfig != null) {
|
|
331
350
|
android_rippleConfig.onPressIn(event);
|
|
@@ -369,7 +388,7 @@ function Pressable({
|
|
|
369
388
|
onHoverIn,
|
|
370
389
|
onHoverOut,
|
|
371
390
|
onLongPress,
|
|
372
|
-
|
|
391
|
+
onPressWithFocus,
|
|
373
392
|
onPressIn,
|
|
374
393
|
onPressMove,
|
|
375
394
|
onPressOut,
|
|
@@ -190,8 +190,19 @@ void ABIViewManager::AddView(const xaml::DependencyObject &parent, const xaml::D
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
void ABIViewManager::RemoveAllChildren(const xaml::DependencyObject &parent) {
|
|
193
|
+
if (!parent) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
193
197
|
if (m_viewManagerWithChildren) {
|
|
194
|
-
|
|
198
|
+
auto fe = parent.try_as<xaml::FrameworkElement>();
|
|
199
|
+
if (fe) {
|
|
200
|
+
try {
|
|
201
|
+
m_viewManagerWithChildren.RemoveAllChildren(fe);
|
|
202
|
+
} catch (...) {
|
|
203
|
+
// External view manager may fail during shutdown if view is already disposed
|
|
204
|
+
}
|
|
205
|
+
}
|
|
195
206
|
} else {
|
|
196
207
|
Super::RemoveAllChildren(parent);
|
|
197
208
|
}
|
|
@@ -45,9 +45,16 @@ enum SnapPointsAlignment {
|
|
|
45
45
|
void Opacity(Single value);
|
|
46
46
|
void BlurRadius(Single value);
|
|
47
47
|
void Color(Windows.UI.Color value);
|
|
48
|
+
void Mask(IBrush mask);
|
|
49
|
+
void SourcePolicy(CompositionDropShadowSourcePolicy policy);
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
[webhosthidden][experimental]
|
|
52
|
+
[webhosthidden][experimental] enum CompositionDropShadowSourcePolicy {
|
|
53
|
+
Default = 0,
|
|
54
|
+
InheritedOnly = 1
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
[webhosthidden][experimental] interface IVisual {
|
|
51
58
|
void InsertAt(IVisual visual, Int32 index);
|
|
52
59
|
void Remove(IVisual visual);
|
|
53
60
|
IVisual GetAt(UInt32 index);
|
|
@@ -72,14 +79,14 @@ enum SnapPointsAlignment {
|
|
|
72
79
|
void AnimationClass(AnimationClass value);
|
|
73
80
|
}
|
|
74
81
|
|
|
75
|
-
[webhosthidden][experimental] interface ISpriteVisual
|
|
82
|
+
[webhosthidden][experimental] interface ISpriteVisual
|
|
76
83
|
requires IVisual
|
|
77
84
|
{
|
|
78
85
|
void Brush(IBrush brush);
|
|
79
86
|
void Shadow(IDropShadow shadow);
|
|
80
87
|
}
|
|
81
88
|
|
|
82
|
-
|
|
89
|
+
[webhosthidden][experimental] interface IRoundedRectangleVisual
|
|
83
90
|
requires IVisual
|
|
84
91
|
{
|
|
85
92
|
void Brush(IBrush brush);
|
|
@@ -88,13 +95,13 @@ enum SnapPointsAlignment {
|
|
|
88
95
|
void StrokeThickness(Single value);
|
|
89
96
|
}
|
|
90
97
|
|
|
91
|
-
[webhosthidden][experimental] interface IScrollPositionChangedArgs {
|
|
98
|
+
[webhosthidden][experimental] interface IScrollPositionChangedArgs {
|
|
92
99
|
Windows.Foundation.Numerics.Vector2 Position {
|
|
93
100
|
get;
|
|
94
101
|
};
|
|
95
102
|
}
|
|
96
103
|
|
|
97
|
-
|
|
104
|
+
[webhosthidden][experimental] interface IScrollVisual
|
|
98
105
|
requires IVisual
|
|
99
106
|
{
|
|
100
107
|
void Brush(IBrush brush);
|
|
@@ -122,7 +129,7 @@ enum SnapPointsAlignment {
|
|
|
122
129
|
void SnapToAlignment(SnapPointsAlignment alignment);
|
|
123
130
|
}
|
|
124
131
|
|
|
125
|
-
[webhosthidden][experimental] interface IActivityVisual
|
|
132
|
+
[webhosthidden][experimental] interface IActivityVisual
|
|
126
133
|
requires IVisual
|
|
127
134
|
{
|
|
128
135
|
void Size(Single value);
|
|
@@ -131,7 +138,7 @@ enum SnapPointsAlignment {
|
|
|
131
138
|
void StopAnimation();
|
|
132
139
|
}
|
|
133
140
|
|
|
134
|
-
|
|
141
|
+
[webhosthidden][experimental] interface ICaretVisual {
|
|
135
142
|
IVisual InnerVisual {
|
|
136
143
|
get;
|
|
137
144
|
};
|
|
@@ -144,7 +151,7 @@ enum SnapPointsAlignment {
|
|
|
144
151
|
void Brush(IBrush brush);
|
|
145
152
|
}
|
|
146
153
|
|
|
147
|
-
[webhosthidden][experimental] interface IFocusVisual {
|
|
154
|
+
[webhosthidden][experimental] interface IFocusVisual {
|
|
148
155
|
IVisual InnerVisual {
|
|
149
156
|
get;
|
|
150
157
|
};
|
|
@@ -158,7 +165,7 @@ enum SnapPointsAlignment {
|
|
|
158
165
|
};
|
|
159
166
|
}
|
|
160
167
|
|
|
161
|
-
|
|
168
|
+
[webhosthidden][experimental] interface ICompositionContext {
|
|
162
169
|
ISpriteVisual CreateSpriteVisual();
|
|
163
170
|
IScrollVisual CreateScrollerVisual();
|
|
164
171
|
IRoundedRectangleVisual CreateRoundedRectangleVisual();
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include "DynamicReader.h"
|
|
9
9
|
|
|
10
10
|
#include "ComponentView.g.cpp"
|
|
11
|
+
#include "CreateAutomationPeerArgs.g.h"
|
|
11
12
|
#include "LayoutMetricsChangedArgs.g.cpp"
|
|
12
13
|
#include "MountChildComponentViewArgs.g.cpp"
|
|
13
14
|
#include "UnmountChildComponentViewArgs.g.cpp"
|
|
@@ -641,7 +642,32 @@ facebook::react::Tag ComponentView::hitTest(
|
|
|
641
642
|
return -1;
|
|
642
643
|
}
|
|
643
644
|
|
|
645
|
+
struct CreateAutomationPeerArgs
|
|
646
|
+
: public winrt::Microsoft::ReactNative::implementation::CreateAutomationPeerArgsT<CreateAutomationPeerArgs> {
|
|
647
|
+
CreateAutomationPeerArgs(winrt::Windows::Foundation::IInspectable defaultAutomationPeer)
|
|
648
|
+
: m_defaultAutomationPeer(defaultAutomationPeer) {}
|
|
649
|
+
|
|
650
|
+
winrt::Windows::Foundation::IInspectable DefaultAutomationPeer() const noexcept {
|
|
651
|
+
return m_defaultAutomationPeer;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
private:
|
|
655
|
+
winrt::Windows::Foundation::IInspectable m_defaultAutomationPeer;
|
|
656
|
+
};
|
|
657
|
+
|
|
644
658
|
winrt::IInspectable ComponentView::EnsureUiaProvider() noexcept {
|
|
659
|
+
if (m_uiaProvider == nullptr) {
|
|
660
|
+
if (m_builder && m_builder->CreateAutomationPeerHandler()) {
|
|
661
|
+
m_uiaProvider = m_builder->CreateAutomationPeerHandler()(
|
|
662
|
+
*this, winrt::make<CreateAutomationPeerArgs>(CreateAutomationProvider()));
|
|
663
|
+
} else {
|
|
664
|
+
m_uiaProvider = CreateAutomationProvider();
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
return m_uiaProvider;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
winrt::Windows::Foundation::IInspectable ComponentView::CreateAutomationProvider() noexcept {
|
|
645
671
|
return nullptr;
|
|
646
672
|
}
|
|
647
673
|
|
|
@@ -208,6 +208,7 @@ struct ComponentView
|
|
|
208
208
|
virtual facebook::react::Tag
|
|
209
209
|
hitTest(facebook::react::Point pt, facebook::react::Point &localPt, bool ignorePointerEvents = false) const noexcept;
|
|
210
210
|
virtual winrt::Windows::Foundation::IInspectable EnsureUiaProvider() noexcept;
|
|
211
|
+
virtual winrt::Windows::Foundation::IInspectable CreateAutomationProvider() noexcept;
|
|
211
212
|
virtual std::optional<std::string> getAccessiblityValue() noexcept;
|
|
212
213
|
virtual void setAcccessiblityValue(std::string &&value) noexcept;
|
|
213
214
|
virtual bool getAcccessiblityIsReadOnly() noexcept;
|
|
@@ -265,6 +266,7 @@ struct ComponentView
|
|
|
265
266
|
facebook::react::LayoutMetrics m_layoutMetrics;
|
|
266
267
|
winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::ReactNative::ComponentView> m_children{
|
|
267
268
|
winrt::single_threaded_vector<winrt::Microsoft::ReactNative::ComponentView>()};
|
|
269
|
+
winrt::Windows::Foundation::IInspectable m_uiaProvider{nullptr};
|
|
268
270
|
|
|
269
271
|
winrt::event<
|
|
270
272
|
winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs>>
|
|
@@ -8,11 +8,8 @@
|
|
|
8
8
|
namespace winrt::Microsoft::ReactNative::implementation {
|
|
9
9
|
|
|
10
10
|
CompositionAnnotationProvider::CompositionAnnotationProvider(
|
|
11
|
-
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView
|
|
12
|
-
|
|
13
|
-
: m_view{componentView} {
|
|
14
|
-
m_parentProvider.copy_from(parentProvider);
|
|
15
|
-
}
|
|
11
|
+
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView) noexcept
|
|
12
|
+
: m_view{componentView} {}
|
|
16
13
|
HRESULT __stdcall CompositionAnnotationProvider::get_AnnotationTypeId(int *retVal) {
|
|
17
14
|
if (retVal == nullptr)
|
|
18
15
|
return E_POINTER;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <Fabric/Composition/CompositionDynamicAutomationProvider.h>
|
|
4
3
|
#include <Fabric/Composition/CompositionViewComponentView.h>
|
|
5
4
|
#include <Fabric/ReactTaggedView.h>
|
|
6
5
|
#include <UIAutomation.h>
|
|
@@ -12,8 +11,7 @@ namespace winrt::Microsoft::ReactNative::implementation {
|
|
|
12
11
|
class CompositionAnnotationProvider : public winrt::implements<CompositionAnnotationProvider, IAnnotationProvider> {
|
|
13
12
|
public:
|
|
14
13
|
CompositionAnnotationProvider(
|
|
15
|
-
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView
|
|
16
|
-
CompositionDynamicAutomationProvider *parentProvider) noexcept;
|
|
14
|
+
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView) noexcept;
|
|
17
15
|
|
|
18
16
|
// inherited via IAnnotationProvider
|
|
19
17
|
virtual HRESULT __stdcall get_AnnotationTypeId(int *retVal) override;
|
|
@@ -25,7 +23,6 @@ class CompositionAnnotationProvider : public winrt::implements<CompositionAnnota
|
|
|
25
23
|
private:
|
|
26
24
|
::Microsoft::ReactNative::ReactTaggedView m_view;
|
|
27
25
|
winrt::com_ptr<IAnnotationProvider> m_annotationProvider;
|
|
28
|
-
winrt::com_ptr<CompositionDynamicAutomationProvider> m_parentProvider;
|
|
29
26
|
};
|
|
30
27
|
|
|
31
28
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -54,6 +54,7 @@ struct CompositionTypeTraits<WindowsTypeTag> {
|
|
|
54
54
|
using CompositionStretch = winrt::Windows::UI::Composition::CompositionStretch;
|
|
55
55
|
using CompositionStrokeCap = winrt::Windows::UI::Composition::CompositionStrokeCap;
|
|
56
56
|
using CompositionSurfaceBrush = winrt::Windows::UI::Composition::CompositionSurfaceBrush;
|
|
57
|
+
using CompositionDropShadowSourcePolicy = winrt::Windows::UI::Composition::CompositionDropShadowSourcePolicy;
|
|
57
58
|
using Compositor = winrt::Windows::UI::Composition::Compositor;
|
|
58
59
|
using ContainerVisual = winrt::Windows::UI::Composition::ContainerVisual;
|
|
59
60
|
using CubicBezierEasingFunction = winrt::Windows::UI::Composition::CubicBezierEasingFunction;
|
|
@@ -127,6 +128,7 @@ struct CompositionTypeTraits<MicrosoftTypeTag> {
|
|
|
127
128
|
using CompositionStretch = winrt::Microsoft::UI::Composition::CompositionStretch;
|
|
128
129
|
using CompositionStrokeCap = winrt::Microsoft::UI::Composition::CompositionStrokeCap;
|
|
129
130
|
using CompositionSurfaceBrush = winrt::Microsoft::UI::Composition::CompositionSurfaceBrush;
|
|
131
|
+
using CompositionDropShadowSourcePolicy = winrt::Microsoft::UI::Composition::CompositionDropShadowSourcePolicy;
|
|
130
132
|
using Compositor = winrt::Microsoft::UI::Composition::Compositor;
|
|
131
133
|
using ContainerVisual = winrt::Microsoft::UI::Composition::ContainerVisual;
|
|
132
134
|
using CubicBezierEasingFunction = winrt::Microsoft::UI::Composition::CubicBezierEasingFunction;
|
|
@@ -224,6 +226,19 @@ struct CompDropShadow : public winrt::implements<
|
|
|
224
226
|
m_shadow.Color(color);
|
|
225
227
|
}
|
|
226
228
|
|
|
229
|
+
void Mask(winrt::Microsoft::ReactNative::Composition::Experimental::IBrush const &mask) noexcept {
|
|
230
|
+
if (mask) {
|
|
231
|
+
m_shadow.Mask(mask.as<typename TTypeRedirects::IInnerCompositionBrush>()->InnerBrush());
|
|
232
|
+
} else {
|
|
233
|
+
m_shadow.Mask(nullptr);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
void SourcePolicy(
|
|
238
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::CompositionDropShadowSourcePolicy policy) noexcept {
|
|
239
|
+
m_shadow.SourcePolicy(static_cast<typename TTypeRedirects::CompositionDropShadowSourcePolicy>(policy));
|
|
240
|
+
}
|
|
241
|
+
|
|
227
242
|
private:
|
|
228
243
|
typename TTypeRedirects::DropShadow m_shadow;
|
|
229
244
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#include "CompositionDynamicAutomationProvider.h"
|
|
3
3
|
#include <Fabric/ComponentView.h>
|
|
4
4
|
#include <Fabric/Composition/CompositionAnnotationProvider.h>
|
|
5
|
+
#include <Fabric/Composition/CompositionTextProvider.h>
|
|
5
6
|
#include <Fabric/Composition/CompositionTextRangeProvider.h>
|
|
6
7
|
#include <Fabric/Composition/ParagraphComponentView.h>
|
|
7
8
|
#include <Fabric/Composition/ScrollViewComponentView.h>
|
|
@@ -45,19 +46,6 @@ CompositionDynamicAutomationProvider::CompositionDynamicAutomationProvider(
|
|
|
45
46
|
if (props->accessibilityState.has_value() && props->accessibilityState->selected.has_value()) {
|
|
46
47
|
AddSelectionItemsToContainer(this);
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
-
if (strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::WindowsTextInputComponentView>() ||
|
|
50
|
-
strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ParagraphComponentView>()) {
|
|
51
|
-
m_textProvider = winrt::make<CompositionTextProvider>(
|
|
52
|
-
strongView.as<winrt::Microsoft::ReactNative::Composition::ComponentView>(), this)
|
|
53
|
-
.try_as<ITextProvider2>();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ViewComponentView>()) {
|
|
57
|
-
m_annotationProvider = winrt::make<CompositionAnnotationProvider>(
|
|
58
|
-
strongView.as<winrt::Microsoft::ReactNative::Composition::ComponentView>(), this)
|
|
59
|
-
.try_as<IAnnotationProvider>();
|
|
60
|
-
}
|
|
61
49
|
}
|
|
62
50
|
|
|
63
51
|
CompositionDynamicAutomationProvider::CompositionDynamicAutomationProvider(
|
|
@@ -161,6 +149,13 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::SetFocus(void) {
|
|
|
161
149
|
return UiaSetFocusHelper(m_view);
|
|
162
150
|
}
|
|
163
151
|
|
|
152
|
+
winrt::IUnknown CompositionDynamicAutomationProvider::TryGetChildSiteLinkAutomationProvider() {
|
|
153
|
+
if (m_childSiteLink) {
|
|
154
|
+
return m_childSiteLink.AutomationProvider().as<winrt::IUnknown>();
|
|
155
|
+
}
|
|
156
|
+
return nullptr;
|
|
157
|
+
}
|
|
158
|
+
|
|
164
159
|
HRESULT __stdcall CompositionDynamicAutomationProvider::get_FragmentRoot(IRawElementProviderFragmentRoot **pRetVal) {
|
|
165
160
|
if (pRetVal == nullptr)
|
|
166
161
|
return E_POINTER;
|
|
@@ -297,16 +292,31 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPatternProvider(PATTE
|
|
|
297
292
|
if (patternId == UIA_TextPatternId &&
|
|
298
293
|
(strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::WindowsTextInputComponentView>() ||
|
|
299
294
|
strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ParagraphComponentView>())) {
|
|
295
|
+
if (!m_textProvider) {
|
|
296
|
+
m_textProvider = winrt::make<CompositionTextProvider>(
|
|
297
|
+
strongView.as<winrt::Microsoft::ReactNative::Composition::ComponentView>())
|
|
298
|
+
.as<ITextProvider2>();
|
|
299
|
+
}
|
|
300
300
|
m_textProvider.as<IUnknown>().copy_to(pRetVal);
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
if (patternId == UIA_TextPattern2Id &&
|
|
304
304
|
strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::WindowsTextInputComponentView>()) {
|
|
305
|
+
if (!m_textProvider) {
|
|
306
|
+
m_textProvider = winrt::make<CompositionTextProvider>(
|
|
307
|
+
strongView.as<winrt::Microsoft::ReactNative::Composition::ComponentView>())
|
|
308
|
+
.as<ITextProvider2>();
|
|
309
|
+
}
|
|
305
310
|
m_textProvider.as<IUnknown>().copy_to(pRetVal);
|
|
306
311
|
}
|
|
307
312
|
if (patternId == UIA_AnnotationPatternId &&
|
|
308
313
|
strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ViewComponentView>() &&
|
|
309
314
|
accessibilityAnnotationHasValue(props->accessibilityAnnotation)) {
|
|
315
|
+
if (!m_annotationProvider) {
|
|
316
|
+
m_annotationProvider = winrt::make<CompositionAnnotationProvider>(
|
|
317
|
+
strongView.as<winrt::Microsoft::ReactNative::Composition::ComponentView>())
|
|
318
|
+
.as<IAnnotationProvider>();
|
|
319
|
+
}
|
|
310
320
|
m_annotationProvider.as<IUnknown>().copy_to(pRetVal);
|
|
311
321
|
}
|
|
312
322
|
|
|
@@ -949,9 +959,18 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetSelection(SAFEARRAY *
|
|
|
949
959
|
std::vector<int> selectedItems;
|
|
950
960
|
for (size_t i = 0; i < m_selectionItems.size(); i++) {
|
|
951
961
|
auto selectionItem = m_selectionItems.at(i);
|
|
952
|
-
|
|
962
|
+
|
|
963
|
+
winrt::com_ptr<IUnknown> unkSelectionItemProvider;
|
|
964
|
+
auto hr = selectionItem->GetPatternProvider(UIA_SelectionItemPatternId, unkSelectionItemProvider.put());
|
|
965
|
+
if (FAILED(hr))
|
|
966
|
+
return hr;
|
|
967
|
+
|
|
968
|
+
auto selectionItemProvider = unkSelectionItemProvider.try_as<ISelectionItemProvider>();
|
|
969
|
+
if (!selectionItemProvider)
|
|
970
|
+
return E_FAIL;
|
|
971
|
+
|
|
953
972
|
BOOL selected;
|
|
954
|
-
|
|
973
|
+
hr = selectionItemProvider->get_IsSelected(&selected);
|
|
955
974
|
if (hr == S_OK && selected) {
|
|
956
975
|
selectedItems.push_back(int(i));
|
|
957
976
|
}
|
|
@@ -1010,27 +1029,28 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::get_IsSelected(BOOL *pRe
|
|
|
1010
1029
|
return S_OK;
|
|
1011
1030
|
}
|
|
1012
1031
|
|
|
1013
|
-
|
|
1032
|
+
winrt::Microsoft::ReactNative::ComponentView findSelectionContainer(
|
|
1033
|
+
winrt::Microsoft::ReactNative::ComponentView current) noexcept {
|
|
1014
1034
|
if (!current)
|
|
1015
1035
|
return nullptr;
|
|
1016
1036
|
|
|
1017
|
-
auto
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
current.as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>()->EnsureUiaProvider();
|
|
1023
|
-
if (uiaProvider != nullptr) {
|
|
1024
|
-
auto spProviderSimple = uiaProvider.try_as<IRawElementProviderSimple>();
|
|
1025
|
-
if (spProviderSimple != nullptr) {
|
|
1026
|
-
spProviderSimple->AddRef();
|
|
1027
|
-
return spProviderSimple.get();
|
|
1028
|
-
}
|
|
1037
|
+
if (auto viewbase = current.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>()) {
|
|
1038
|
+
auto props = viewbase->viewProps();
|
|
1039
|
+
if (props->accessibilityState.has_value() && props->accessibilityState->multiselectable.has_value() &&
|
|
1040
|
+
props->accessibilityState->required.has_value()) {
|
|
1041
|
+
return current;
|
|
1029
1042
|
}
|
|
1030
|
-
} else {
|
|
1031
|
-
return findSelectionContainer(current.Parent());
|
|
1032
1043
|
}
|
|
1033
|
-
return
|
|
1044
|
+
return findSelectionContainer(current.Parent());
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
winrt::Microsoft::ReactNative::ComponentView CompositionDynamicAutomationProvider::GetSelectionContainer() noexcept {
|
|
1048
|
+
auto strongView = m_view.view();
|
|
1049
|
+
|
|
1050
|
+
if (!strongView)
|
|
1051
|
+
return nullptr;
|
|
1052
|
+
|
|
1053
|
+
return findSelectionContainer(strongView.Parent());
|
|
1034
1054
|
}
|
|
1035
1055
|
|
|
1036
1056
|
HRESULT __stdcall CompositionDynamicAutomationProvider::get_SelectionContainer(IRawElementProviderSimple **pRetVal) {
|
|
@@ -1041,7 +1061,20 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::get_SelectionContainer(I
|
|
|
1041
1061
|
if (!strongView)
|
|
1042
1062
|
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
1043
1063
|
|
|
1044
|
-
*pRetVal =
|
|
1064
|
+
*pRetVal = nullptr;
|
|
1065
|
+
|
|
1066
|
+
auto selectionContainerView = GetSelectionContainer();
|
|
1067
|
+
auto uiaProvider =
|
|
1068
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(selectionContainerView)
|
|
1069
|
+
->EnsureUiaProvider();
|
|
1070
|
+
if (uiaProvider != nullptr) {
|
|
1071
|
+
auto spProviderSimple = uiaProvider.try_as<IRawElementProviderSimple>();
|
|
1072
|
+
if (spProviderSimple != nullptr) {
|
|
1073
|
+
spProviderSimple->AddRef();
|
|
1074
|
+
*pRetVal = spProviderSimple.get();
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1045
1078
|
return S_OK;
|
|
1046
1079
|
}
|
|
1047
1080
|
|
|
@@ -97,6 +97,15 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
|
|
|
97
97
|
|
|
98
98
|
void AddToSelectionItems(winrt::com_ptr<IRawElementProviderSimple> &item);
|
|
99
99
|
void RemoveFromSelectionItems(winrt::com_ptr<IRawElementProviderSimple> &item);
|
|
100
|
+
winrt::Microsoft::ReactNative::ComponentView GetSelectionContainer() noexcept;
|
|
101
|
+
|
|
102
|
+
void SetChildSiteLink(winrt::Microsoft::UI::Content::ChildSiteLink childSiteLink) {
|
|
103
|
+
m_childSiteLink = childSiteLink;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// If this object is for a ChildSiteLink, returns the ChildSiteLink's automation provider.
|
|
107
|
+
// This will be a provider object from the hosted framework (for example, WinUI).
|
|
108
|
+
winrt::IUnknown TryGetChildSiteLinkAutomationProvider();
|
|
100
109
|
|
|
101
110
|
private:
|
|
102
111
|
::Microsoft::ReactNative::ReactTaggedView m_view;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
#include <winrt/Windows.UI.Input.h>
|
|
16
16
|
#include "Composition.Input.h"
|
|
17
17
|
#include "CompositionViewComponentView.h"
|
|
18
|
+
#include "ParagraphComponentView.h"
|
|
18
19
|
#include "ReactNativeIsland.h"
|
|
19
20
|
#include "RootComponentView.h"
|
|
20
21
|
|
|
@@ -1101,6 +1102,13 @@ void CompositionEventHandler::onPointerExited(
|
|
|
1101
1102
|
void CompositionEventHandler::onPointerPressed(
|
|
1102
1103
|
const winrt::Microsoft::ReactNative::Composition::Input::PointerPoint &pointerPoint,
|
|
1103
1104
|
winrt::Windows::System::VirtualKeyModifiers keyModifiers) noexcept {
|
|
1105
|
+
namespace Composition = winrt::Microsoft::ReactNative::Composition;
|
|
1106
|
+
|
|
1107
|
+
// Clears any active text selection when left pointer is pressed
|
|
1108
|
+
if (pointerPoint.Properties().PointerUpdateKind() != Composition::Input::PointerUpdateKind::RightButtonPressed) {
|
|
1109
|
+
RootComponentView().ClearCurrentTextSelection();
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1104
1112
|
PointerId pointerId = pointerPoint.PointerId();
|
|
1105
1113
|
|
|
1106
1114
|
auto staleTouch = std::find_if(m_activeTouches.begin(), m_activeTouches.end(), [pointerId](const auto &pair) {
|
|
@@ -219,7 +219,8 @@ HRESULT __stdcall CompositionRootAutomationProvider::ElementProviderFromPoint(
|
|
|
219
219
|
auto local = rootView->ConvertScreenToLocal({static_cast<float>(x), static_cast<float>(y)});
|
|
220
220
|
auto provider = rootView->UiaProviderFromPoint(
|
|
221
221
|
{static_cast<LONG>(local.X * rootView->LayoutMetrics().PointScaleFactor),
|
|
222
|
-
static_cast<LONG>(local.Y * rootView->LayoutMetrics().PointScaleFactor)}
|
|
222
|
+
static_cast<LONG>(local.Y * rootView->LayoutMetrics().PointScaleFactor)},
|
|
223
|
+
{static_cast<LONG>(x), static_cast<LONG>(y)});
|
|
223
224
|
auto spFragment = provider.try_as<IRawElementProviderFragment>();
|
|
224
225
|
if (spFragment) {
|
|
225
226
|
*pRetVal = spFragment.detach();
|
|
@@ -10,10 +10,8 @@
|
|
|
10
10
|
namespace winrt::Microsoft::ReactNative::implementation {
|
|
11
11
|
|
|
12
12
|
CompositionTextProvider::CompositionTextProvider(
|
|
13
|
-
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView
|
|
14
|
-
CompositionDynamicAutomationProvider *parentProvider) noexcept
|
|
13
|
+
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView) noexcept
|
|
15
14
|
: m_view{componentView} {
|
|
16
|
-
m_parentProvider.copy_from(parentProvider);
|
|
17
15
|
EnsureTextRangeProvider();
|
|
18
16
|
}
|
|
19
17
|
|
|
@@ -24,10 +22,9 @@ void CompositionTextProvider::EnsureTextRangeProvider() {
|
|
|
24
22
|
return;
|
|
25
23
|
|
|
26
24
|
if (!m_textRangeProvider) {
|
|
27
|
-
m_textRangeProvider =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.try_as<ITextRangeProvider>();
|
|
25
|
+
m_textRangeProvider = winrt::make<CompositionTextRangeProvider>(
|
|
26
|
+
strongView.as<winrt::Microsoft::ReactNative::Composition::ComponentView>())
|
|
27
|
+
.as<ITextRangeProvider>();
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
30
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <Fabric/Composition/CompositionDynamicAutomationProvider.h>
|
|
4
3
|
#include <Fabric/Composition/CompositionViewComponentView.h>
|
|
5
4
|
#include <Fabric/ReactTaggedView.h>
|
|
6
5
|
#include <UIAutomation.h>
|
|
@@ -11,9 +10,7 @@ namespace winrt::Microsoft::ReactNative::implementation {
|
|
|
11
10
|
|
|
12
11
|
class CompositionTextProvider : public winrt::implements<CompositionTextProvider, ITextProvider, ITextProvider2> {
|
|
13
12
|
public:
|
|
14
|
-
CompositionTextProvider(
|
|
15
|
-
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView,
|
|
16
|
-
CompositionDynamicAutomationProvider *parentProvider) noexcept;
|
|
13
|
+
CompositionTextProvider(const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView) noexcept;
|
|
17
14
|
|
|
18
15
|
// inherited via ITextProvider
|
|
19
16
|
virtual HRESULT __stdcall get_DocumentRange(ITextRangeProvider **pRetVal) override;
|
|
@@ -35,7 +32,6 @@ class CompositionTextProvider : public winrt::implements<CompositionTextProvider
|
|
|
35
32
|
private:
|
|
36
33
|
::Microsoft::ReactNative::ReactTaggedView m_view;
|
|
37
34
|
winrt::com_ptr<ITextRangeProvider> m_textRangeProvider;
|
|
38
|
-
winrt::com_ptr<CompositionDynamicAutomationProvider> m_parentProvider;
|
|
39
35
|
};
|
|
40
36
|
|
|
41
37
|
} // namespace winrt::Microsoft::ReactNative::implementation
|