react-native-windows 0.75.9 → 0.75.10
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/Microsoft.ReactNative/CompositionComponentView.idl +2 -1
- package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.cpp +4 -1
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +7 -0
- package/Microsoft.ReactNative/Fabric/AbiViewProps.h +2 -0
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +19 -4
- package/Microsoft.ReactNative/Fabric/ComponentView.h +8 -3
- package/Microsoft.ReactNative/Fabric/Composition/BorderPrimitive.cpp +931 -0
- package/Microsoft.ReactNative/Fabric/Composition/BorderPrimitive.h +80 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +31 -13
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +27 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +3 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +8 -32
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +302 -895
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +26 -26
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +130 -122
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +14 -8
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +34 -20
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +5 -3
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +63 -2
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -0
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +51 -3
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +18 -8
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +46 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +5 -0
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +9 -3
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +11 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +1 -1
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +1 -0
- package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +1 -1
- package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +25 -129
- package/Microsoft.ReactNative/ReactNativeAppBuilder.h +5 -13
- package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +13 -34
- package/Microsoft.ReactNative/ReactNativeIsland.idl +3 -2
- package/Microsoft.ReactNative/ReactNativeWin32App.cpp +129 -18
- package/Microsoft.ReactNative/ReactNativeWin32App.h +14 -5
- package/Microsoft.ReactNative/ViewProps.idl +2 -0
- package/Microsoft.ReactNative.Cxx/ComponentView.Experimental.interop.h +14 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/Shared/Shared.vcxitems +3 -10
- package/Shared/Shared.vcxitems.filters +1 -0
- package/package.json +3 -3
- package/templates/cpp-app/windows/MyApp/MyApp.cpp +46 -130
- package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.cpp +0 -59
- package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.h +0 -23
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include <Fabric/ComponentView.h>
|
|
8
|
+
#include <Microsoft.ReactNative.Cxx/ReactContext.h>
|
|
9
|
+
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
10
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
11
|
+
#include "CompositionHelpers.h"
|
|
12
|
+
|
|
13
|
+
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
14
|
+
|
|
15
|
+
struct ComponentView;
|
|
16
|
+
|
|
17
|
+
// Controls adding/removing appropriate visuals to a parent to render a specific border without requiring
|
|
18
|
+
struct BorderPrimitive {
|
|
19
|
+
static constexpr size_t SpecialBorderLayerCount = 8;
|
|
20
|
+
|
|
21
|
+
// Use when attaching to an existing visual - We do this for View's border properties, to optimize the number of
|
|
22
|
+
// visuals for each view.
|
|
23
|
+
BorderPrimitive(
|
|
24
|
+
winrt::Microsoft::ReactNative::Composition::implementation::ComponentView &outer,
|
|
25
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::IVisual &rootVisual);
|
|
26
|
+
|
|
27
|
+
// This ctor creates a new root visual that can then be added to the visual tree
|
|
28
|
+
BorderPrimitive(winrt::Microsoft::ReactNative::Composition::implementation::ComponentView &outer);
|
|
29
|
+
|
|
30
|
+
void markNeedsUpdate() noexcept;
|
|
31
|
+
|
|
32
|
+
// We hoist focus visuals up the tree to allow them to be higher in the z-order.
|
|
33
|
+
// This means a single BorderPrimitive may change the owning ComponentView as focus moves around
|
|
34
|
+
void setOuter(winrt::Microsoft::ReactNative::Composition::implementation::ComponentView *outer) noexcept;
|
|
35
|
+
|
|
36
|
+
void updateProps(
|
|
37
|
+
const facebook::react::ViewProps &oldViewProps,
|
|
38
|
+
const facebook::react::ViewProps &newViewProps) noexcept;
|
|
39
|
+
void finalize(
|
|
40
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
41
|
+
const facebook::react::BorderMetrics &borderMetrics) noexcept;
|
|
42
|
+
void onThemeChanged(
|
|
43
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
44
|
+
const facebook::react::BorderMetrics &borderMetrics) noexcept;
|
|
45
|
+
|
|
46
|
+
uint8_t numberOfVisuals() const noexcept;
|
|
47
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual RootVisual() const noexcept;
|
|
48
|
+
|
|
49
|
+
static facebook::react::BorderMetrics resolveAndAlignBorderMetrics(
|
|
50
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
51
|
+
const facebook::react::ViewProps &viewProps) noexcept;
|
|
52
|
+
|
|
53
|
+
static bool requiresBorder(
|
|
54
|
+
const facebook::react::BorderMetrics &borderMetrics,
|
|
55
|
+
winrt::Microsoft::ReactNative::Composition::implementation::Theme *theme) noexcept;
|
|
56
|
+
|
|
57
|
+
static winrt::com_ptr<ID2D1PathGeometry> GenerateRoundedRectPathGeometry(
|
|
58
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
59
|
+
const facebook::react::RectangleCorners<float> &baseRadius,
|
|
60
|
+
const facebook::react::RectangleEdges<float> &inset,
|
|
61
|
+
const facebook::react::RectangleEdges<float> &rectPathGeometry) noexcept;
|
|
62
|
+
|
|
63
|
+
private:
|
|
64
|
+
std::array<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual, SpecialBorderLayerCount>
|
|
65
|
+
FindSpecialBorderLayers() const noexcept;
|
|
66
|
+
|
|
67
|
+
bool TryUpdateSpecialBorderLayers(
|
|
68
|
+
winrt::Microsoft::ReactNative::Composition::implementation::Theme *theme,
|
|
69
|
+
std::array<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual, SpecialBorderLayerCount>
|
|
70
|
+
&spBorderVisuals,
|
|
71
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
72
|
+
const facebook::react::BorderMetrics &borderMetrics) noexcept;
|
|
73
|
+
|
|
74
|
+
uint8_t m_numBorderVisuals{0};
|
|
75
|
+
winrt::Microsoft::ReactNative::Composition::implementation::ComponentView *m_outer;
|
|
76
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual m_rootVisual{nullptr};
|
|
77
|
+
bool m_needsUpdate{true};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#include "pch.h"
|
|
2
2
|
#include "CompositionDynamicAutomationProvider.h"
|
|
3
3
|
#include <Fabric/ComponentView.h>
|
|
4
|
+
#include <Fabric/Composition/SwitchComponentView.h>
|
|
5
|
+
#include <Fabric/Composition/TextInput/WindowsTextInputComponentView.h>
|
|
4
6
|
#include <Unicode.h>
|
|
5
7
|
#include "RootComponentView.h"
|
|
6
8
|
#include "UiaHelpers.h"
|
|
@@ -141,6 +143,20 @@ bool expandableControl(const facebook::react::SharedViewProps props) {
|
|
|
141
143
|
return false;
|
|
142
144
|
}
|
|
143
145
|
|
|
146
|
+
bool togglableControl(const facebook::react::SharedViewProps props) {
|
|
147
|
+
if (props->accessibilityState.has_value() &&
|
|
148
|
+
props->accessibilityState->checked != facebook::react::AccessibilityState::None) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
auto accessibilityActions = props->accessibilityActions;
|
|
152
|
+
for (size_t i = 0; i < accessibilityActions.size(); i++) {
|
|
153
|
+
if (accessibilityActions[i].name == "toggle") {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
|
|
144
160
|
HRESULT __stdcall CompositionDynamicAutomationProvider::GetPatternProvider(PATTERNID patternId, IUnknown **pRetVal) {
|
|
145
161
|
if (pRetVal == nullptr)
|
|
146
162
|
return E_POINTER;
|
|
@@ -158,10 +174,7 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPatternProvider(PATTE
|
|
|
158
174
|
auto accessibilityRole = props->accessibilityRole;
|
|
159
175
|
// Invoke control pattern is used to support controls that do not maintain state
|
|
160
176
|
// when activated but rather initiate or perform a single, unambiguous action.
|
|
161
|
-
if (patternId == UIA_InvokePatternId &&
|
|
162
|
-
(accessibilityRole == "button" || accessibilityRole == "imagebutton" || accessibilityRole == "link" ||
|
|
163
|
-
accessibilityRole == "splitbutton" || (accessibilityRole == "menuitem" && props->onAccessibilityTap) ||
|
|
164
|
-
(accessibilityRole == "treeitem" && props->onAccessibilityTap))) {
|
|
177
|
+
if (patternId == UIA_InvokePatternId && (props->onAccessibilityTap)) {
|
|
165
178
|
*pRetVal = static_cast<IInvokeProvider *>(this);
|
|
166
179
|
AddRef();
|
|
167
180
|
}
|
|
@@ -171,21 +184,21 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPatternProvider(PATTE
|
|
|
171
184
|
AddRef();
|
|
172
185
|
}
|
|
173
186
|
|
|
174
|
-
if (patternId == UIA_ValuePatternId
|
|
187
|
+
if (patternId == UIA_ValuePatternId &&
|
|
188
|
+
(strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::WindowsTextInputComponentView>() ||
|
|
189
|
+
accessibilityValueHasValue(props->accessibilityValue))) {
|
|
175
190
|
*pRetVal = static_cast<IValueProvider *>(this);
|
|
176
191
|
AddRef();
|
|
177
192
|
}
|
|
178
193
|
|
|
179
|
-
if (patternId == UIA_TogglePatternId &&
|
|
194
|
+
if (patternId == UIA_TogglePatternId &&
|
|
195
|
+
(strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::SwitchComponentView>() ||
|
|
196
|
+
togglableControl(props))) {
|
|
180
197
|
*pRetVal = static_cast<IToggleProvider *>(this);
|
|
181
198
|
AddRef();
|
|
182
199
|
}
|
|
183
200
|
|
|
184
|
-
if (patternId == UIA_ExpandCollapsePatternId &&
|
|
185
|
-
(accessibilityRole == "combobox" || accessibilityRole == "splitbutton" || accessibilityRole == "treeitem" ||
|
|
186
|
-
(expandableControl(props) &&
|
|
187
|
-
(accessibilityRole == "toolbar" || accessibilityRole == "menuitem" || accessibilityRole == "menubar" ||
|
|
188
|
-
accessibilityRole == "listitem" || accessibilityRole == "group" || accessibilityRole == "button")))) {
|
|
201
|
+
if (patternId == UIA_ExpandCollapsePatternId && expandableControl(props)) {
|
|
189
202
|
*pRetVal = static_cast<IExpandCollapseProvider *>(this);
|
|
190
203
|
AddRef();
|
|
191
204
|
}
|
|
@@ -480,8 +493,13 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::get_ToggleState(ToggleSt
|
|
|
480
493
|
if (!strongView)
|
|
481
494
|
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
482
495
|
|
|
483
|
-
|
|
484
|
-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->
|
|
496
|
+
auto props = std::static_pointer_cast<const facebook::react::ViewProps>(
|
|
497
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->props());
|
|
498
|
+
|
|
499
|
+
*pRetVal = (props->accessibilityState.has_value() &&
|
|
500
|
+
props->accessibilityState->checked != facebook::react::AccessibilityState::None)
|
|
501
|
+
? GetToggleState(props->accessibilityState)
|
|
502
|
+
: winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->getToggleState();
|
|
485
503
|
return S_OK;
|
|
486
504
|
}
|
|
487
505
|
|
|
@@ -139,8 +139,9 @@ struct CompositionInputKeyboardSource : winrt::implements<
|
|
|
139
139
|
|
|
140
140
|
CompositionEventHandler::CompositionEventHandler(
|
|
141
141
|
const winrt::Microsoft::ReactNative::ReactContext &context,
|
|
142
|
-
const winrt::Microsoft::ReactNative::ReactNativeIsland &reactNativeIsland
|
|
143
|
-
|
|
142
|
+
const winrt::Microsoft::ReactNative::ReactNativeIsland &reactNativeIsland,
|
|
143
|
+
const int fragmentTag)
|
|
144
|
+
: m_fragmentTag(fragmentTag), m_context(context), m_wkRootView(reactNativeIsland) {}
|
|
144
145
|
|
|
145
146
|
void CompositionEventHandler::Initialize() noexcept {
|
|
146
147
|
#ifdef USE_WINUI3
|
|
@@ -831,7 +832,30 @@ void CompositionEventHandler::getTargetPointerArgs(
|
|
|
831
832
|
ptLocal.y = ptScaled.y - (clientRect.top / strongRootView.ScaleFactor());
|
|
832
833
|
}
|
|
833
834
|
} else {
|
|
834
|
-
|
|
835
|
+
if (m_fragmentTag == -1) {
|
|
836
|
+
tag = RootComponentView().hitTest(ptScaled, ptLocal);
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
// check if the fragment tag exists
|
|
841
|
+
if (!fabricuiManager->GetViewRegistry().findComponentViewWithTag(m_fragmentTag)) {
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
auto fagmentView = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(m_fragmentTag).view;
|
|
846
|
+
auto fagmentchildren = fagmentView.Children();
|
|
847
|
+
|
|
848
|
+
// call the hitTest with the fargment as the RootComponent
|
|
849
|
+
for (auto index = fagmentchildren.Size(); index > 0; index--) {
|
|
850
|
+
auto childView = fagmentchildren.GetAt(index - 1);
|
|
851
|
+
auto targetTag =
|
|
852
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(childView)->hitTest(
|
|
853
|
+
ptScaled, ptLocal);
|
|
854
|
+
if (targetTag != -1) {
|
|
855
|
+
tag = targetTag;
|
|
856
|
+
break;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
835
859
|
}
|
|
836
860
|
}
|
|
837
861
|
|
|
@@ -31,7 +31,8 @@ class CompositionEventHandler : public std::enable_shared_from_this<CompositionE
|
|
|
31
31
|
public:
|
|
32
32
|
CompositionEventHandler(
|
|
33
33
|
const winrt::Microsoft::ReactNative::ReactContext &context,
|
|
34
|
-
const winrt::Microsoft::ReactNative::ReactNativeIsland &ReactNativeIsland
|
|
34
|
+
const winrt::Microsoft::ReactNative::ReactNativeIsland &ReactNativeIsland,
|
|
35
|
+
const int fragmentTag);
|
|
35
36
|
virtual ~CompositionEventHandler();
|
|
36
37
|
|
|
37
38
|
void Initialize() noexcept;
|
|
@@ -148,6 +149,7 @@ class CompositionEventHandler : public std::enable_shared_from_this<CompositionE
|
|
|
148
149
|
|
|
149
150
|
std::map<PointerId, ActiveTouch> m_activeTouches; // iOS is map of touch event args to ActiveTouch..?
|
|
150
151
|
PointerId m_touchId = 0;
|
|
152
|
+
int m_fragmentTag = -1;
|
|
151
153
|
|
|
152
154
|
std::map<PointerId, std::vector<ReactTaggedView>> m_currentlyHoveredViewsPerPointer;
|
|
153
155
|
winrt::weak_ref<winrt::Microsoft::ReactNative::ReactNativeIsland> m_wkRootView;
|
|
@@ -189,40 +189,16 @@ HRESULT __stdcall CompositionRootAutomationProvider::ElementProviderFromPoint(
|
|
|
189
189
|
*pRetVal = nullptr;
|
|
190
190
|
|
|
191
191
|
if (auto rootView = rootComponentView()) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
static_cast<LONG>(local.Y * m_island.RasterizationScale())});
|
|
200
|
-
auto spFragment = provider.try_as<IRawElementProviderFragment>();
|
|
201
|
-
if (spFragment) {
|
|
202
|
-
*pRetVal = spFragment.detach();
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return S_OK;
|
|
192
|
+
auto local = rootView->ConvertScreenToLocal({static_cast<float>(x), static_cast<float>(y)});
|
|
193
|
+
auto provider = rootView->UiaProviderFromPoint(
|
|
194
|
+
{static_cast<LONG>(local.X * rootView->LayoutMetrics().PointScaleFactor),
|
|
195
|
+
static_cast<LONG>(local.Y * rootView->LayoutMetrics().PointScaleFactor)});
|
|
196
|
+
auto spFragment = provider.try_as<IRawElementProviderFragment>();
|
|
197
|
+
if (spFragment) {
|
|
198
|
+
*pRetVal = spFragment.detach();
|
|
206
199
|
}
|
|
207
|
-
#endif
|
|
208
200
|
|
|
209
|
-
|
|
210
|
-
if (!IsWindow(m_hwnd)) {
|
|
211
|
-
// TODO: Add support for non-HWND based hosting
|
|
212
|
-
assert(false);
|
|
213
|
-
return E_FAIL;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
POINT clientPoint{static_cast<LONG>(x), static_cast<LONG>(y)};
|
|
217
|
-
ScreenToClient(m_hwnd, &clientPoint);
|
|
218
|
-
|
|
219
|
-
auto provider = rootView->UiaProviderFromPoint(clientPoint);
|
|
220
|
-
auto spFragment = provider.try_as<IRawElementProviderFragment>();
|
|
221
|
-
if (spFragment) {
|
|
222
|
-
*pRetVal = spFragment.detach();
|
|
223
|
-
return S_OK;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
201
|
+
return S_OK;
|
|
226
202
|
}
|
|
227
203
|
|
|
228
204
|
AddRef();
|