react-native-windows 0.76.8 → 0.76.9
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/Button.windows.js +9 -0
- package/Libraries/Components/Pressable/Pressable.windows.js +9 -0
- package/Libraries/Components/TextInput/TextInput.windows.js +11 -1
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +229 -0
- package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +373 -0
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +7 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +8 -0
- package/Libraries/Components/View/View.windows.js +11 -1
- package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
- package/Libraries/Components/View/ViewAccessibility.windows.js +3 -0
- package/Libraries/Components/View/ViewPropTypes.windows.js +3 -0
- package/Libraries/Image/Image.windows.js +7 -0
- package/Libraries/Modal/Modal.windows.js +4 -1
- package/Libraries/Text/Text.windows.js +14 -1
- package/Libraries/Text/TextProps.windows.js +3 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
- package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.cpp +97 -0
- package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.h +53 -0
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.h +160 -17
- package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +8 -10
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +4 -2
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +428 -39
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +39 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +55 -33
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +5 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +43 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.cpp +115 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextProvider.h +41 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.cpp +298 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionTextRangeProvider.h +59 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +106 -56
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +163 -10
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +17 -1
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +4 -2
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +9 -1
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +348 -316
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +78 -0
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +22 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -5
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +99 -37
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +81 -22
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +21 -2
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +6 -1
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +41 -37
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +76 -33
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +8 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +1 -6
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +5 -8
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorParser.h +1 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +1 -1
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +15 -1
- package/Microsoft.ReactNative/IReactContext.cpp +2 -2
- package/Microsoft.ReactNative/IReactContext.h +1 -1
- package/Microsoft.ReactNative/IReactContext.idl +2 -2
- package/Microsoft.ReactNative/IReactPackageBuilder.idl +3 -3
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +97 -87
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +4 -0
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +9 -4
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +1 -1
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +32 -35
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +7 -4
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +2 -2
- package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +2 -2
- package/Microsoft.ReactNative/Modules/ClipboardModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +3 -3
- package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +7 -5
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -1
- package/Microsoft.ReactNative/Modules/Timing.cpp +2 -2
- package/Microsoft.ReactNative/ReactHost/IReactInstance.h +5 -0
- package/Microsoft.ReactNative/ReactHost/React.h +0 -3
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +36 -12
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
- package/Microsoft.ReactNative/ReactNativeHost.cpp +9 -4
- package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
- package/Microsoft.ReactNative/ReactPackageBuilder.cpp +3 -3
- package/Microsoft.ReactNative/ReactPackageBuilder.h +4 -4
- package/Microsoft.ReactNative/Utils/Helpers.cpp +0 -2
- package/Microsoft.ReactNative/Views/DevMenu.cpp +6 -6
- package/Microsoft.ReactNative/Views/DevMenu.h +1 -1
- package/Microsoft.ReactNative/XamlUIService.cpp +13 -7
- package/Microsoft.ReactNative/XamlUIService.h +4 -1
- package/Microsoft.ReactNative/XamlUIService.idl +2 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +6 -2
- package/Microsoft.ReactNative.Cxx/NativeModules.h +29 -0
- package/Microsoft.ReactNative.Cxx/ReactContext.h +1 -1
- package/Microsoft.ReactNative.Cxx/XamlUtils.h +12 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/React.Cpp.props +3 -0
- package/PropertySheets/WebView2.props +1 -1
- package/PropertySheets/WinUI.props +5 -4
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +253 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +799 -0
- package/Shared/InspectorPackagerConnection.cpp +2 -5
- package/Shared/InspectorPackagerConnection.h +2 -2
- package/Shared/Networking/WinRTWebSocketResource.cpp +369 -7
- package/Shared/Networking/WinRTWebSocketResource.h +118 -0
- package/Shared/Shared.vcxitems +12 -5
- package/Shared/Shared.vcxitems.filters +11 -4
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
- package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
- package/codegen/react/components/rnwcore/ModalHostView.g.h +279 -0
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
- package/codegen/react/components/rnwcore/Switch.g.h +263 -0
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
- package/just-task.js +1 -1
- package/package.json +3 -3
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +0 -191
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
|
@@ -11,12 +11,15 @@
|
|
|
11
11
|
#include <UI.Xaml.Controls.h>
|
|
12
12
|
#include <Utils/ValueUtils.h>
|
|
13
13
|
#include <winrt/Microsoft.UI.Content.h>
|
|
14
|
+
#include <winrt/Microsoft.UI.Input.h>
|
|
14
15
|
#include <winrt/Windows.UI.Composition.h>
|
|
15
16
|
#include "CompositionContextHelper.h"
|
|
16
17
|
#include "RootComponentView.h"
|
|
17
18
|
|
|
18
19
|
#include "Composition.ContentIslandComponentView.g.cpp"
|
|
19
20
|
|
|
21
|
+
#include "CompositionDynamicAutomationProvider.h"
|
|
22
|
+
|
|
20
23
|
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
21
24
|
|
|
22
25
|
ContentIslandComponentView::ContentIslandComponentView(
|
|
@@ -42,13 +45,29 @@ ContentIslandComponentView::ContentIslandComponentView(
|
|
|
42
45
|
|
|
43
46
|
void ContentIslandComponentView::OnMounted() noexcept {
|
|
44
47
|
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
45
|
-
|
|
48
|
+
m_childSiteLink = winrt::Microsoft::UI::Content::ChildSiteLink::Create(
|
|
46
49
|
rootComponentView()->parentContentIsland(),
|
|
47
50
|
winrt::Microsoft::ReactNative::Composition::Experimental::CompositionContextHelper::InnerVisual(Visual())
|
|
48
51
|
.as<winrt::Microsoft::UI::Composition::ContainerVisual>());
|
|
49
|
-
|
|
52
|
+
m_childSiteLink.ActualSize({m_layoutMetrics.frame.size.width, m_layoutMetrics.frame.size.height});
|
|
53
|
+
|
|
54
|
+
m_navigationHost = winrt::Microsoft::UI::Input::InputFocusNavigationHost::GetForSiteLink(m_childSiteLink);
|
|
55
|
+
|
|
56
|
+
m_navigationHostDepartFocusRequestedToken =
|
|
57
|
+
m_navigationHost.DepartFocusRequested([wkThis = get_weak()](const auto &, const auto &args) {
|
|
58
|
+
if (auto strongThis = wkThis.get()) {
|
|
59
|
+
const bool next = (args.Request().Reason() != winrt::Microsoft::UI::Input::FocusNavigationReason::Last);
|
|
60
|
+
strongThis->rootComponentView()->TryMoveFocus(next);
|
|
61
|
+
args.Result(winrt::Microsoft::UI::Input::FocusNavigationResult::Moved);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// We configure automation even if there's no UIA client at this point, because it's possible the first UIA
|
|
66
|
+
// request we'll get will be for a child of this island calling upward in the UIA tree.
|
|
67
|
+
ConfigureChildSiteLinkAutomation();
|
|
68
|
+
|
|
50
69
|
if (m_islandToConnect) {
|
|
51
|
-
|
|
70
|
+
m_childSiteLink.Connect(m_islandToConnect);
|
|
52
71
|
m_islandToConnect = nullptr;
|
|
53
72
|
}
|
|
54
73
|
|
|
@@ -70,6 +89,12 @@ void ContentIslandComponentView::OnMounted() noexcept {
|
|
|
70
89
|
|
|
71
90
|
void ContentIslandComponentView::OnUnmounted() noexcept {
|
|
72
91
|
m_layoutMetricChangedRevokers.clear();
|
|
92
|
+
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
93
|
+
if (m_navigationHostDepartFocusRequestedToken && m_navigationHost) {
|
|
94
|
+
m_navigationHost.DepartFocusRequested(m_navigationHostDepartFocusRequestedToken);
|
|
95
|
+
m_navigationHostDepartFocusRequestedToken = {};
|
|
96
|
+
}
|
|
97
|
+
#endif
|
|
73
98
|
}
|
|
74
99
|
|
|
75
100
|
void ContentIslandComponentView::ParentLayoutChanged() noexcept {
|
|
@@ -82,15 +107,89 @@ void ContentIslandComponentView::ParentLayoutChanged() noexcept {
|
|
|
82
107
|
if (auto strongThis = wkThis.get()) {
|
|
83
108
|
auto clientRect = strongThis->getClientRect();
|
|
84
109
|
|
|
85
|
-
strongThis->
|
|
86
|
-
|
|
110
|
+
strongThis->m_childSiteLink.LocalToParentTransformMatrix(
|
|
111
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_translation(
|
|
112
|
+
static_cast<float>(clientRect.left), static_cast<float>(clientRect.top), 0.0f));
|
|
113
|
+
|
|
87
114
|
strongThis->m_layoutChangePosted = false;
|
|
88
115
|
}
|
|
89
116
|
});
|
|
90
117
|
#endif
|
|
91
118
|
}
|
|
92
119
|
|
|
120
|
+
winrt::IInspectable ContentIslandComponentView::EnsureUiaProvider() noexcept {
|
|
121
|
+
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
122
|
+
if (m_uiaProvider == nullptr) {
|
|
123
|
+
m_uiaProvider = winrt::make<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>(
|
|
124
|
+
*get_strong(), m_childSiteLink);
|
|
125
|
+
}
|
|
126
|
+
return m_uiaProvider;
|
|
127
|
+
#else
|
|
128
|
+
return Super::EnsureUiaProvider();
|
|
129
|
+
#endif
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
bool ContentIslandComponentView::focusable() const noexcept {
|
|
133
|
+
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
134
|
+
// We don't have a way to check to see if the ContentIsland has focusable content,
|
|
135
|
+
// so we'll always return true. We'll have to handle the case where the content doesn't have
|
|
136
|
+
// focusable content in the OnGotFocus handler.
|
|
137
|
+
return true;
|
|
138
|
+
#else
|
|
139
|
+
return Super::focusable();
|
|
140
|
+
#endif
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Helper to convert a FocusNavigationDirection to a FocusNavigationReason.
|
|
144
|
+
winrt::Microsoft::UI::Input::FocusNavigationReason GetFocusNavigationReason(
|
|
145
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection direction) noexcept {
|
|
146
|
+
switch (direction) {
|
|
147
|
+
case winrt::Microsoft::ReactNative::FocusNavigationDirection::First:
|
|
148
|
+
case winrt::Microsoft::ReactNative::FocusNavigationDirection::Next:
|
|
149
|
+
return winrt::Microsoft::UI::Input::FocusNavigationReason::First;
|
|
150
|
+
case winrt::Microsoft::ReactNative::FocusNavigationDirection::Last:
|
|
151
|
+
case winrt::Microsoft::ReactNative::FocusNavigationDirection::Previous:
|
|
152
|
+
return winrt::Microsoft::UI::Input::FocusNavigationReason::Last;
|
|
153
|
+
}
|
|
154
|
+
return winrt::Microsoft::UI::Input::FocusNavigationReason::Restore;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
void ContentIslandComponentView::onGotFocus(
|
|
158
|
+
const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept {
|
|
159
|
+
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
160
|
+
auto gotFocusEventArgs = args.as<winrt::Microsoft::ReactNative::implementation::GotFocusEventArgs>();
|
|
161
|
+
const auto navigationReason = GetFocusNavigationReason(gotFocusEventArgs->Direction());
|
|
162
|
+
m_navigationHost.NavigateFocus(winrt::Microsoft::UI::Input::FocusNavigationRequest::Create(navigationReason));
|
|
163
|
+
#else
|
|
164
|
+
return Super::onGotFocus(args);
|
|
165
|
+
#endif // USE_EXPERIMENTAL_WINUI3
|
|
166
|
+
}
|
|
167
|
+
|
|
93
168
|
ContentIslandComponentView::~ContentIslandComponentView() noexcept {
|
|
169
|
+
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
170
|
+
if (m_navigationHostDepartFocusRequestedToken && m_navigationHost) {
|
|
171
|
+
m_navigationHost.DepartFocusRequested(m_navigationHostDepartFocusRequestedToken);
|
|
172
|
+
m_navigationHostDepartFocusRequestedToken = {};
|
|
173
|
+
}
|
|
174
|
+
if (m_childSiteLink) {
|
|
175
|
+
if (m_fragmentRootAutomationProviderRequestedToken) {
|
|
176
|
+
m_childSiteLink.FragmentRootAutomationProviderRequested(m_fragmentRootAutomationProviderRequestedToken);
|
|
177
|
+
m_fragmentRootAutomationProviderRequestedToken = {};
|
|
178
|
+
}
|
|
179
|
+
if (m_parentAutomationProviderRequestedToken) {
|
|
180
|
+
m_childSiteLink.ParentAutomationProviderRequested(m_parentAutomationProviderRequestedToken);
|
|
181
|
+
m_parentAutomationProviderRequestedToken = {};
|
|
182
|
+
}
|
|
183
|
+
if (m_nextSiblingAutomationProviderRequestedToken) {
|
|
184
|
+
m_childSiteLink.NextSiblingAutomationProviderRequested(m_nextSiblingAutomationProviderRequestedToken);
|
|
185
|
+
m_nextSiblingAutomationProviderRequestedToken = {};
|
|
186
|
+
}
|
|
187
|
+
if (m_previousSiblingAutomationProviderRequestedToken) {
|
|
188
|
+
m_childSiteLink.PreviousSiblingAutomationProviderRequested(m_previousSiblingAutomationProviderRequestedToken);
|
|
189
|
+
m_previousSiblingAutomationProviderRequestedToken = {};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
#endif // USE_EXPERIMENTAL_WINUI3
|
|
94
193
|
if (m_islandToConnect) {
|
|
95
194
|
m_islandToConnect.Close();
|
|
96
195
|
}
|
|
@@ -114,8 +213,8 @@ void ContentIslandComponentView::updateLayoutMetrics(
|
|
|
114
213
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
115
214
|
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept {
|
|
116
215
|
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
117
|
-
if (
|
|
118
|
-
|
|
216
|
+
if (m_childSiteLink) {
|
|
217
|
+
m_childSiteLink.ActualSize({layoutMetrics.frame.size.width, layoutMetrics.frame.size.height});
|
|
119
218
|
ParentLayoutChanged();
|
|
120
219
|
}
|
|
121
220
|
#endif
|
|
@@ -124,17 +223,71 @@ void ContentIslandComponentView::updateLayoutMetrics(
|
|
|
124
223
|
|
|
125
224
|
void ContentIslandComponentView::Connect(const winrt::Microsoft::UI::Content::ContentIsland &contentIsland) noexcept {
|
|
126
225
|
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
127
|
-
if (
|
|
226
|
+
if (m_childSiteLink) {
|
|
128
227
|
m_islandToConnect = nullptr;
|
|
129
|
-
|
|
228
|
+
m_childSiteLink.Connect(contentIsland);
|
|
130
229
|
} else {
|
|
131
230
|
m_islandToConnect = contentIsland;
|
|
132
231
|
}
|
|
133
|
-
#endif
|
|
232
|
+
#endif // USE_EXPERIMENTAL_WINUI3
|
|
134
233
|
}
|
|
135
234
|
|
|
136
235
|
void ContentIslandComponentView::prepareForRecycle() noexcept {
|
|
137
236
|
Super::prepareForRecycle();
|
|
138
237
|
}
|
|
139
238
|
|
|
239
|
+
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
240
|
+
void ContentIslandComponentView::ConfigureChildSiteLinkAutomation() noexcept {
|
|
241
|
+
// This automation mode must be set before connecting the child ContentIsland.
|
|
242
|
+
// It puts the child content into a mode where it won't own its own framework root. Instead, the child island's
|
|
243
|
+
// automation peers will use the same framework root as the automation peer of this ContentIslandComponentView.
|
|
244
|
+
m_childSiteLink.AutomationTreeOption(winrt::Microsoft::UI::Content::AutomationTreeOptions::FragmentBased);
|
|
245
|
+
|
|
246
|
+
// These events are raised in response to the child ContentIsland asking for providers.
|
|
247
|
+
// For example, the ContentIsland.FragmentRootAutomationProvider property will return
|
|
248
|
+
// the provider we provide here in FragmentRootAutomationProviderRequested.
|
|
249
|
+
|
|
250
|
+
// We capture "this" as a raw pointer because ContentIslandComponentView doesn't currently support weak ptrs.
|
|
251
|
+
// It's safe because we disconnect these events in the destructor.
|
|
252
|
+
|
|
253
|
+
m_fragmentRootAutomationProviderRequestedToken = m_childSiteLink.FragmentRootAutomationProviderRequested(
|
|
254
|
+
[this](
|
|
255
|
+
const winrt::Microsoft::UI::Content::IContentSiteAutomation &,
|
|
256
|
+
const winrt::Microsoft::UI::Content::ContentSiteAutomationProviderRequestedEventArgs &args) {
|
|
257
|
+
// The child island's fragment tree doesn't have its own fragment root.
|
|
258
|
+
// Here's how we can provide the correct fragment root to the child's UIA logic.
|
|
259
|
+
winrt::com_ptr<IRawElementProviderFragmentRoot> fragmentRoot{nullptr};
|
|
260
|
+
auto uiaProvider = this->EnsureUiaProvider();
|
|
261
|
+
uiaProvider.as<IRawElementProviderFragment>()->get_FragmentRoot(fragmentRoot.put());
|
|
262
|
+
args.AutomationProvider(fragmentRoot.as<IInspectable>());
|
|
263
|
+
args.Handled(true);
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
m_parentAutomationProviderRequestedToken = m_childSiteLink.ParentAutomationProviderRequested(
|
|
267
|
+
[this](
|
|
268
|
+
const winrt::Microsoft::UI::Content::IContentSiteAutomation &,
|
|
269
|
+
const winrt::Microsoft::UI::Content::ContentSiteAutomationProviderRequestedEventArgs &args) {
|
|
270
|
+
auto uiaProvider = this->EnsureUiaProvider();
|
|
271
|
+
args.AutomationProvider(uiaProvider);
|
|
272
|
+
args.Handled(true);
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
m_nextSiblingAutomationProviderRequestedToken = m_childSiteLink.NextSiblingAutomationProviderRequested(
|
|
276
|
+
[](const winrt::Microsoft::UI::Content::IContentSiteAutomation &,
|
|
277
|
+
const winrt::Microsoft::UI::Content::ContentSiteAutomationProviderRequestedEventArgs &args) {
|
|
278
|
+
// The ContentIsland will always be the one and only child of this node, so it won't have siblings.
|
|
279
|
+
args.AutomationProvider(nullptr);
|
|
280
|
+
args.Handled(true);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
m_previousSiblingAutomationProviderRequestedToken = m_childSiteLink.PreviousSiblingAutomationProviderRequested(
|
|
284
|
+
[](const winrt::Microsoft::UI::Content::IContentSiteAutomation &,
|
|
285
|
+
const winrt::Microsoft::UI::Content::ContentSiteAutomationProviderRequestedEventArgs &args) {
|
|
286
|
+
// The ContentIsland will always be the one and only child of this node, so it won't have siblings.
|
|
287
|
+
args.AutomationProvider(nullptr);
|
|
288
|
+
args.Handled(true);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
#endif // USE_EXPERIMENTAL_WINUI3
|
|
292
|
+
|
|
140
293
|
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
#include <Microsoft.ReactNative.Cxx/ReactContext.h>
|
|
10
10
|
#include <winrt/Microsoft.UI.Content.h>
|
|
11
|
+
#include <winrt/Microsoft.UI.Input.h>
|
|
11
12
|
#include <winrt/Windows.UI.Composition.h>
|
|
12
13
|
#include "CompositionHelpers.h"
|
|
13
14
|
#include "CompositionViewComponentView.h"
|
|
@@ -37,6 +38,12 @@ struct ContentIslandComponentView : ContentIslandComponentViewT<ContentIslandCom
|
|
|
37
38
|
|
|
38
39
|
void prepareForRecycle() noexcept override;
|
|
39
40
|
|
|
41
|
+
bool focusable() const noexcept override;
|
|
42
|
+
|
|
43
|
+
winrt::IInspectable EnsureUiaProvider() noexcept override;
|
|
44
|
+
|
|
45
|
+
void onGotFocus(const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept override;
|
|
46
|
+
|
|
40
47
|
ContentIslandComponentView(
|
|
41
48
|
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
42
49
|
facebook::react::Tag tag,
|
|
@@ -55,7 +62,16 @@ struct ContentIslandComponentView : ContentIslandComponentViewT<ContentIslandCom
|
|
|
55
62
|
winrt::event_token m_unmountedToken;
|
|
56
63
|
std::vector<winrt::Microsoft::ReactNative::ComponentView::LayoutMetricsChanged_revoker> m_layoutMetricChangedRevokers;
|
|
57
64
|
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
58
|
-
winrt::Microsoft::UI::Content::
|
|
65
|
+
winrt::Microsoft::UI::Content::ChildSiteLink m_childSiteLink{nullptr};
|
|
66
|
+
winrt::Microsoft::UI::Input::InputFocusNavigationHost m_navigationHost{nullptr};
|
|
67
|
+
winrt::event_token m_navigationHostDepartFocusRequestedToken{};
|
|
68
|
+
|
|
69
|
+
// Automation
|
|
70
|
+
void ConfigureChildSiteLinkAutomation() noexcept;
|
|
71
|
+
winrt::event_token m_fragmentRootAutomationProviderRequestedToken{};
|
|
72
|
+
winrt::event_token m_parentAutomationProviderRequestedToken{};
|
|
73
|
+
winrt::event_token m_nextSiblingAutomationProviderRequestedToken{};
|
|
74
|
+
winrt::event_token m_previousSiblingAutomationProviderRequestedToken{};
|
|
59
75
|
#endif
|
|
60
76
|
};
|
|
61
77
|
|
|
@@ -14,8 +14,10 @@ int32_t LostFocusEventArgs::OriginalSource() noexcept {
|
|
|
14
14
|
return m_originalSource;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
GotFocusEventArgs::GotFocusEventArgs(
|
|
18
|
-
|
|
17
|
+
GotFocusEventArgs::GotFocusEventArgs(
|
|
18
|
+
const winrt::Microsoft::ReactNative::ComponentView &originalSource,
|
|
19
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection direction)
|
|
20
|
+
: m_originalSource(originalSource ? originalSource.Tag() : -1), m_direction(direction) {}
|
|
19
21
|
int32_t GotFocusEventArgs::OriginalSource() noexcept {
|
|
20
22
|
return m_originalSource;
|
|
21
23
|
}
|
|
@@ -21,11 +21,19 @@ struct LostFocusEventArgs
|
|
|
21
21
|
|
|
22
22
|
struct GotFocusEventArgs
|
|
23
23
|
: winrt::implements<GotFocusEventArgs, winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs> {
|
|
24
|
-
GotFocusEventArgs(
|
|
24
|
+
GotFocusEventArgs(
|
|
25
|
+
const winrt::Microsoft::ReactNative::ComponentView &originalSource,
|
|
26
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection direction);
|
|
25
27
|
int32_t OriginalSource() noexcept;
|
|
26
28
|
|
|
29
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection Direction() const noexcept {
|
|
30
|
+
return m_direction;
|
|
31
|
+
}
|
|
32
|
+
|
|
27
33
|
private:
|
|
28
34
|
const int32_t m_originalSource;
|
|
35
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection m_direction{
|
|
36
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection::None};
|
|
29
37
|
};
|
|
30
38
|
|
|
31
39
|
struct LosingFocusEventArgs
|