react-native-windows 0.76.10 → 0.76.12
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/Directory.Build.props +2 -2
- package/Folly/TEMP_UntilFollyUpdate/json.cpp +4 -0
- package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.cpp +23 -15
- package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.h +5 -5
- package/Folly/cgmanifest.json +1 -1
- package/Libraries/Components/Button.windows.js +3 -0
- package/Libraries/Components/ScrollView/ScrollView.windows.js +1959 -0
- package/Libraries/Components/View/View.windows.js +107 -56
- package/Libraries/Image/Image.windows.js +42 -21
- package/Libraries/Text/Text.d.ts +16 -1
- package/Microsoft.ReactNative/CompositionComponentView.idl +0 -5
- package/Microsoft.ReactNative/CompositionSwitcher.idl +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +32 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +159 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +11 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +0 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +22 -17
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +1 -27
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +36 -11
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +50 -125
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +9 -6
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +31 -12
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +6 -1
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +145 -19
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +13 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +134 -11
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +6 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.cpp +31 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h +14 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.cpp +6 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +127 -109
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +28 -25
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +8 -18
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h +12 -35
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +53 -11
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +10 -2
- package/Microsoft.ReactNative/Fabric/ImageRequestParams.cpp +26 -0
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +38 -8
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.h +3 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +206 -41
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.h +14 -0
- package/Microsoft.ReactNative/Modules/Animated/AnimationDriver.cpp +2 -1
- package/Microsoft.ReactNative/ReactNativeIsland.idl +3 -0
- package/Microsoft.ReactNative/Utils/ImageUtils.h +1 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/NuGet.LockFile.props +1 -1
- package/PropertySheets/WebView2.props +1 -1
- package/PropertySheets/WinUI.props +1 -1
- package/Shared/Networking/WinRTWebSocketResource.cpp +82 -96
- package/Shared/Networking/WinRTWebSocketResource.h +91 -7
- package/Shared/Shared.vcxitems +3 -1
- package/Shared/Shared.vcxitems.filters +1 -0
- package/package.json +1 -1
|
@@ -174,7 +174,6 @@ HRESULT __stdcall CompositionRootAutomationProvider::get_FragmentRoot(IRawElemen
|
|
|
174
174
|
|
|
175
175
|
*pRetVal = nullptr;
|
|
176
176
|
|
|
177
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
178
177
|
if (m_island) {
|
|
179
178
|
auto parentRoot = m_island.FragmentRootAutomationProvider();
|
|
180
179
|
auto spFragment = parentRoot.try_as<IRawElementProviderFragmentRoot>();
|
|
@@ -183,7 +182,6 @@ HRESULT __stdcall CompositionRootAutomationProvider::get_FragmentRoot(IRawElemen
|
|
|
183
182
|
return S_OK;
|
|
184
183
|
}
|
|
185
184
|
}
|
|
186
|
-
#endif
|
|
187
185
|
|
|
188
186
|
return S_OK;
|
|
189
187
|
}
|
|
@@ -288,7 +286,6 @@ HRESULT __stdcall CompositionRootAutomationProvider::Navigate(
|
|
|
288
286
|
}
|
|
289
287
|
}
|
|
290
288
|
} else if (direction == NavigateDirection_Parent) {
|
|
291
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
292
289
|
if (m_island) {
|
|
293
290
|
auto parent = m_island.ParentAutomationProvider();
|
|
294
291
|
auto spFragment = parent.try_as<IRawElementProviderFragment>();
|
|
@@ -297,7 +294,6 @@ HRESULT __stdcall CompositionRootAutomationProvider::Navigate(
|
|
|
297
294
|
return S_OK;
|
|
298
295
|
}
|
|
299
296
|
}
|
|
300
|
-
#endif
|
|
301
297
|
}
|
|
302
298
|
*pRetVal = nullptr;
|
|
303
299
|
return S_OK;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
#include <Utils/KeyboardUtils.h>
|
|
16
16
|
#include <Utils/ValueUtils.h>
|
|
17
17
|
#include <Views/FrameworkElementTransferProperties.h>
|
|
18
|
+
#include <atlcomcli.h>
|
|
18
19
|
#include <winrt/Microsoft.ReactNative.Composition.Experimental.h>
|
|
19
20
|
#include <winrt/Microsoft.UI.Input.h>
|
|
20
21
|
#include <winrt/Windows.UI.Composition.h>
|
|
@@ -331,9 +332,9 @@ void ComponentView::onLostFocus(
|
|
|
331
332
|
|
|
332
333
|
m_componentHostingFocusVisual->hostFocusVisual(false, get_strong());
|
|
333
334
|
}
|
|
334
|
-
if (
|
|
335
|
+
if (UiaClientsAreListening()) {
|
|
335
336
|
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
336
|
-
|
|
337
|
+
EnsureUiaProvider(), UIA_HasKeyboardFocusPropertyId, true, false);
|
|
337
338
|
}
|
|
338
339
|
}
|
|
339
340
|
base_type::onLostFocus(args);
|
|
@@ -381,8 +382,8 @@ void ComponentView::onGotFocus(
|
|
|
381
382
|
focusRect.size.height += (FOCUS_VISUAL_WIDTH * 2);
|
|
382
383
|
focusVisualRoot(focusRect)->hostFocusVisual(true, get_strong());
|
|
383
384
|
}
|
|
384
|
-
if (
|
|
385
|
-
auto spProviderSimple =
|
|
385
|
+
if (UiaClientsAreListening()) {
|
|
386
|
+
auto spProviderSimple = EnsureUiaProvider().try_as<IRawElementProviderSimple>();
|
|
386
387
|
if (spProviderSimple != nullptr) {
|
|
387
388
|
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
388
389
|
m_uiaProvider, UIA_HasKeyboardFocusPropertyId, false, true);
|
|
@@ -743,59 +744,62 @@ void ComponentView::updateTransformProps(
|
|
|
743
744
|
void ComponentView::updateAccessibilityProps(
|
|
744
745
|
const facebook::react::ViewProps &oldViewProps,
|
|
745
746
|
const facebook::react::ViewProps &newViewProps) noexcept {
|
|
746
|
-
if (!
|
|
747
|
+
if (!UiaClientsAreListening())
|
|
747
748
|
return;
|
|
748
749
|
|
|
749
750
|
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
750
|
-
|
|
751
|
+
EnsureUiaProvider(), UIA_IsKeyboardFocusablePropertyId, oldViewProps.focusable, newViewProps.focusable);
|
|
751
752
|
|
|
752
753
|
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
753
|
-
|
|
754
|
+
EnsureUiaProvider(),
|
|
754
755
|
UIA_NamePropertyId,
|
|
755
756
|
oldViewProps.accessibilityLabel,
|
|
756
757
|
newViewProps.accessibilityLabel.empty() ? DefaultAccessibleName() : newViewProps.accessibilityLabel);
|
|
757
758
|
|
|
758
759
|
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
759
|
-
|
|
760
|
+
EnsureUiaProvider(),
|
|
760
761
|
UIA_IsContentElementPropertyId,
|
|
761
762
|
(oldViewProps.accessible && oldViewProps.accessibilityRole != "none"),
|
|
762
763
|
(newViewProps.accessible && newViewProps.accessibilityRole != "none"));
|
|
763
764
|
|
|
764
765
|
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
765
|
-
|
|
766
|
+
EnsureUiaProvider(),
|
|
766
767
|
UIA_IsControlElementPropertyId,
|
|
767
768
|
(oldViewProps.accessible && oldViewProps.accessibilityRole != "none"),
|
|
768
769
|
(newViewProps.accessible && newViewProps.accessibilityRole != "none"));
|
|
769
770
|
|
|
770
771
|
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
771
|
-
|
|
772
|
+
EnsureUiaProvider(),
|
|
772
773
|
UIA_IsEnabledPropertyId,
|
|
773
774
|
!(oldViewProps.accessibilityState && oldViewProps.accessibilityState->disabled),
|
|
774
775
|
!(newViewProps.accessibilityState && newViewProps.accessibilityState->disabled));
|
|
775
776
|
|
|
776
777
|
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
777
|
-
|
|
778
|
+
EnsureUiaProvider(),
|
|
778
779
|
UIA_IsEnabledPropertyId,
|
|
779
780
|
!(oldViewProps.accessibilityState && oldViewProps.accessibilityState->busy),
|
|
780
781
|
!(newViewProps.accessibilityState && newViewProps.accessibilityState->busy));
|
|
781
782
|
|
|
782
783
|
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
783
|
-
|
|
784
|
+
EnsureUiaProvider(), UIA_ControlTypePropertyId, oldViewProps.accessibilityRole, newViewProps.accessibilityRole);
|
|
784
785
|
|
|
785
786
|
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
786
|
-
|
|
787
|
+
EnsureUiaProvider(), UIA_HelpTextPropertyId, oldViewProps.accessibilityHint, newViewProps.accessibilityHint);
|
|
787
788
|
|
|
788
789
|
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
789
|
-
|
|
790
|
+
EnsureUiaProvider(),
|
|
790
791
|
UIA_PositionInSetPropertyId,
|
|
791
792
|
oldViewProps.accessibilityPosInSet,
|
|
792
793
|
newViewProps.accessibilityPosInSet);
|
|
793
794
|
|
|
794
795
|
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
795
|
-
|
|
796
|
+
EnsureUiaProvider(),
|
|
797
|
+
UIA_SizeOfSetPropertyId,
|
|
798
|
+
oldViewProps.accessibilitySetSize,
|
|
799
|
+
newViewProps.accessibilitySetSize);
|
|
796
800
|
|
|
797
801
|
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
|
|
798
|
-
|
|
802
|
+
EnsureUiaProvider(),
|
|
799
803
|
UIA_LiveSettingPropertyId,
|
|
800
804
|
oldViewProps.accessibilityLiveRegion,
|
|
801
805
|
newViewProps.accessibilityLiveRegion);
|
|
@@ -803,7 +807,8 @@ void ComponentView::updateAccessibilityProps(
|
|
|
803
807
|
if ((oldViewProps.accessibilityState.has_value() && oldViewProps.accessibilityState->selected.has_value()) !=
|
|
804
808
|
((newViewProps.accessibilityState.has_value() && newViewProps.accessibilityState->selected.has_value()))) {
|
|
805
809
|
auto compProvider =
|
|
806
|
-
|
|
810
|
+
EnsureUiaProvider()
|
|
811
|
+
.try_as<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>();
|
|
807
812
|
if (compProvider) {
|
|
808
813
|
if ((newViewProps.accessibilityState.has_value() && newViewProps.accessibilityState->selected.has_value())) {
|
|
809
814
|
winrt::Microsoft::ReactNative::implementation::AddSelectionItemsToContainer(compProvider.get());
|
|
@@ -44,7 +44,6 @@ ContentIslandComponentView::ContentIslandComponentView(
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
void ContentIslandComponentView::OnMounted() noexcept {
|
|
47
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
48
47
|
m_childSiteLink = winrt::Microsoft::UI::Content::ChildSiteLink::Create(
|
|
49
48
|
rootComponentView()->parentContentIsland(),
|
|
50
49
|
winrt::Microsoft::ReactNative::Composition::Experimental::CompositionContextHelper::InnerVisual(Visual())
|
|
@@ -84,21 +83,17 @@ void ContentIslandComponentView::OnMounted() noexcept {
|
|
|
84
83
|
}));
|
|
85
84
|
view = view.Parent();
|
|
86
85
|
}
|
|
87
|
-
#endif
|
|
88
86
|
}
|
|
89
87
|
|
|
90
88
|
void ContentIslandComponentView::OnUnmounted() noexcept {
|
|
91
89
|
m_layoutMetricChangedRevokers.clear();
|
|
92
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
93
90
|
if (m_navigationHostDepartFocusRequestedToken && m_navigationHost) {
|
|
94
91
|
m_navigationHost.DepartFocusRequested(m_navigationHostDepartFocusRequestedToken);
|
|
95
92
|
m_navigationHostDepartFocusRequestedToken = {};
|
|
96
93
|
}
|
|
97
|
-
#endif
|
|
98
94
|
}
|
|
99
95
|
|
|
100
96
|
void ContentIslandComponentView::ParentLayoutChanged() noexcept {
|
|
101
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
102
97
|
if (m_layoutChangePosted)
|
|
103
98
|
return;
|
|
104
99
|
|
|
@@ -114,30 +109,21 @@ void ContentIslandComponentView::ParentLayoutChanged() noexcept {
|
|
|
114
109
|
strongThis->m_layoutChangePosted = false;
|
|
115
110
|
}
|
|
116
111
|
});
|
|
117
|
-
#endif
|
|
118
112
|
}
|
|
119
113
|
|
|
120
114
|
winrt::IInspectable ContentIslandComponentView::EnsureUiaProvider() noexcept {
|
|
121
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
122
115
|
if (m_uiaProvider == nullptr) {
|
|
123
116
|
m_uiaProvider = winrt::make<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>(
|
|
124
117
|
*get_strong(), m_childSiteLink);
|
|
125
118
|
}
|
|
126
119
|
return m_uiaProvider;
|
|
127
|
-
#else
|
|
128
|
-
return Super::EnsureUiaProvider();
|
|
129
|
-
#endif
|
|
130
120
|
}
|
|
131
121
|
|
|
132
122
|
bool ContentIslandComponentView::focusable() const noexcept {
|
|
133
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
134
123
|
// We don't have a way to check to see if the ContentIsland has focusable content,
|
|
135
124
|
// so we'll always return true. We'll have to handle the case where the content doesn't have
|
|
136
125
|
// focusable content in the OnGotFocus handler.
|
|
137
126
|
return true;
|
|
138
|
-
#else
|
|
139
|
-
return Super::focusable();
|
|
140
|
-
#endif
|
|
141
127
|
}
|
|
142
128
|
|
|
143
129
|
// Helper to convert a FocusNavigationDirection to a FocusNavigationReason.
|
|
@@ -156,17 +142,12 @@ winrt::Microsoft::UI::Input::FocusNavigationReason GetFocusNavigationReason(
|
|
|
156
142
|
|
|
157
143
|
void ContentIslandComponentView::onGotFocus(
|
|
158
144
|
const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept {
|
|
159
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
160
145
|
auto gotFocusEventArgs = args.as<winrt::Microsoft::ReactNative::implementation::GotFocusEventArgs>();
|
|
161
146
|
const auto navigationReason = GetFocusNavigationReason(gotFocusEventArgs->Direction());
|
|
162
147
|
m_navigationHost.NavigateFocus(winrt::Microsoft::UI::Input::FocusNavigationRequest::Create(navigationReason));
|
|
163
|
-
#else
|
|
164
|
-
return Super::onGotFocus(args);
|
|
165
|
-
#endif // USE_EXPERIMENTAL_WINUI3
|
|
166
148
|
}
|
|
167
149
|
|
|
168
150
|
ContentIslandComponentView::~ContentIslandComponentView() noexcept {
|
|
169
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
170
151
|
if (m_navigationHostDepartFocusRequestedToken && m_navigationHost) {
|
|
171
152
|
m_navigationHost.DepartFocusRequested(m_navigationHostDepartFocusRequestedToken);
|
|
172
153
|
m_navigationHostDepartFocusRequestedToken = {};
|
|
@@ -189,7 +170,6 @@ ContentIslandComponentView::~ContentIslandComponentView() noexcept {
|
|
|
189
170
|
m_previousSiblingAutomationProviderRequestedToken = {};
|
|
190
171
|
}
|
|
191
172
|
}
|
|
192
|
-
#endif // USE_EXPERIMENTAL_WINUI3
|
|
193
173
|
if (m_islandToConnect) {
|
|
194
174
|
m_islandToConnect.Close();
|
|
195
175
|
}
|
|
@@ -212,36 +192,31 @@ void ContentIslandComponentView::UnmountChildComponentView(
|
|
|
212
192
|
void ContentIslandComponentView::updateLayoutMetrics(
|
|
213
193
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
214
194
|
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept {
|
|
215
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
216
195
|
if (m_childSiteLink) {
|
|
217
196
|
m_childSiteLink.ActualSize({layoutMetrics.frame.size.width, layoutMetrics.frame.size.height});
|
|
218
197
|
ParentLayoutChanged();
|
|
219
198
|
}
|
|
220
|
-
#endif
|
|
221
199
|
base_type::updateLayoutMetrics(layoutMetrics, oldLayoutMetrics);
|
|
222
200
|
}
|
|
223
201
|
|
|
224
202
|
void ContentIslandComponentView::Connect(const winrt::Microsoft::UI::Content::ContentIsland &contentIsland) noexcept {
|
|
225
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
226
203
|
if (m_childSiteLink) {
|
|
227
204
|
m_islandToConnect = nullptr;
|
|
228
205
|
m_childSiteLink.Connect(contentIsland);
|
|
229
206
|
} else {
|
|
230
207
|
m_islandToConnect = contentIsland;
|
|
231
208
|
}
|
|
232
|
-
#endif // USE_EXPERIMENTAL_WINUI3
|
|
233
209
|
}
|
|
234
210
|
|
|
235
211
|
void ContentIslandComponentView::prepareForRecycle() noexcept {
|
|
236
212
|
Super::prepareForRecycle();
|
|
237
213
|
}
|
|
238
214
|
|
|
239
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
240
215
|
void ContentIslandComponentView::ConfigureChildSiteLinkAutomation() noexcept {
|
|
241
216
|
// This automation mode must be set before connecting the child ContentIsland.
|
|
242
217
|
// It puts the child content into a mode where it won't own its own framework root. Instead, the child island's
|
|
243
218
|
// automation peers will use the same framework root as the automation peer of this ContentIslandComponentView.
|
|
244
|
-
m_childSiteLink.
|
|
219
|
+
m_childSiteLink.AutomationOption(winrt::Microsoft::UI::Content::ContentAutomationOptions::FragmentBased);
|
|
245
220
|
|
|
246
221
|
// These events are raised in response to the child ContentIsland asking for providers.
|
|
247
222
|
// For example, the ContentIsland.FragmentRootAutomationProvider property will return
|
|
@@ -288,6 +263,5 @@ void ContentIslandComponentView::ConfigureChildSiteLinkAutomation() noexcept {
|
|
|
288
263
|
args.Handled(true);
|
|
289
264
|
});
|
|
290
265
|
}
|
|
291
|
-
#endif // USE_EXPERIMENTAL_WINUI3
|
|
292
266
|
|
|
293
267
|
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -61,7 +61,6 @@ struct ContentIslandComponentView : ContentIslandComponentViewT<ContentIslandCom
|
|
|
61
61
|
winrt::event_token m_mountedToken;
|
|
62
62
|
winrt::event_token m_unmountedToken;
|
|
63
63
|
std::vector<winrt::Microsoft::ReactNative::ComponentView::LayoutMetricsChanged_revoker> m_layoutMetricChangedRevokers;
|
|
64
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
65
64
|
winrt::Microsoft::UI::Content::ChildSiteLink m_childSiteLink{nullptr};
|
|
66
65
|
winrt::Microsoft::UI::Input::InputFocusNavigationHost m_navigationHost{nullptr};
|
|
67
66
|
winrt::event_token m_navigationHostDepartFocusRequestedToken{};
|
|
@@ -72,7 +71,6 @@ struct ContentIslandComponentView : ContentIslandComponentViewT<ContentIslandCom
|
|
|
72
71
|
winrt::event_token m_parentAutomationProviderRequestedToken{};
|
|
73
72
|
winrt::event_token m_nextSiblingAutomationProviderRequestedToken{};
|
|
74
73
|
winrt::event_token m_previousSiblingAutomationProviderRequestedToken{};
|
|
75
|
-
#endif
|
|
76
74
|
};
|
|
77
75
|
|
|
78
76
|
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -31,24 +31,29 @@ extern "C" HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT SDKVersion, IWICIma
|
|
|
31
31
|
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
32
32
|
|
|
33
33
|
ImageComponentView::WindowsImageResponseObserver::WindowsImageResponseObserver(
|
|
34
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext,
|
|
34
35
|
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView> wkImage)
|
|
35
|
-
: m_wkImage(std::move(wkImage)) {}
|
|
36
|
+
: m_reactContext(reactContext), m_wkImage(std::move(wkImage)) {}
|
|
36
37
|
|
|
37
38
|
void ImageComponentView::WindowsImageResponseObserver::didReceiveProgress(float progress, int64_t loaded, int64_t total)
|
|
38
39
|
const {
|
|
39
|
-
|
|
40
|
+
int loadedInt = static_cast<int>(loaded);
|
|
41
|
+
int totalInt = static_cast<int>(total);
|
|
42
|
+
m_reactContext.UIDispatcher().Post([progress, wkImage = m_wkImage, loadedInt, totalInt]() {
|
|
43
|
+
if (auto image = wkImage.get()) {
|
|
44
|
+
image->didReceiveProgress(progress, loadedInt, totalInt);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
void ImageComponentView::WindowsImageResponseObserver::didReceiveImage(
|
|
43
50
|
facebook::react::ImageResponse const &imageResponse) const {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
}
|
|
51
|
+
auto imageResponseImage = std::static_pointer_cast<ImageResponseImage>(imageResponse.getImage());
|
|
52
|
+
m_reactContext.UIDispatcher().Post([imageResponseImage, wkImage = m_wkImage]() {
|
|
53
|
+
if (auto image{wkImage.get()}) {
|
|
54
|
+
image->didReceiveImage(imageResponseImage);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
void ImageComponentView::WindowsImageResponseObserver::didReceiveFailure(
|
|
@@ -95,6 +100,21 @@ void ImageComponentView::ImageLoadStart() noexcept {
|
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
102
|
|
|
103
|
+
void ImageComponentView::ImageLoaded() noexcept {
|
|
104
|
+
auto imageEventEmitter = std::static_pointer_cast<facebook::react::ImageEventEmitter const>(m_eventEmitter);
|
|
105
|
+
if (imageEventEmitter) {
|
|
106
|
+
imageEventEmitter->onLoadEnd();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
void ImageComponentView::didReceiveProgress(float progress, int loaded, int total) noexcept {
|
|
111
|
+
auto imageEventEmitter = std::static_pointer_cast<facebook::react::ImageEventEmitter const>(m_eventEmitter);
|
|
112
|
+
if (imageEventEmitter) {
|
|
113
|
+
imageEventEmitter->onProgress(progress, loaded, total);
|
|
114
|
+
}
|
|
115
|
+
ensureDrawingSurface();
|
|
116
|
+
}
|
|
117
|
+
|
|
98
118
|
void ImageComponentView::didReceiveImage(const std::shared_ptr<ImageResponseImage> &imageResponseImage) noexcept {
|
|
99
119
|
// TODO check for recycled?
|
|
100
120
|
|
|
@@ -152,7 +172,7 @@ void ImageComponentView::updateState(
|
|
|
152
172
|
auto newImageState = std::static_pointer_cast<facebook::react::ImageShadowNode::ConcreteState const>(state);
|
|
153
173
|
|
|
154
174
|
if (!m_imageResponseObserver) {
|
|
155
|
-
m_imageResponseObserver = std::make_shared<WindowsImageResponseObserver>(get_weak());
|
|
175
|
+
m_imageResponseObserver = std::make_shared<WindowsImageResponseObserver>(this->m_reactContext, get_weak());
|
|
156
176
|
}
|
|
157
177
|
|
|
158
178
|
setStateAndResubscribeImageResponseObserver(newImageState);
|
|
@@ -281,6 +301,11 @@ void ImageComponentView::ensureDrawingSurface() noexcept {
|
|
|
281
301
|
: winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::Uniform);
|
|
282
302
|
break;
|
|
283
303
|
}
|
|
304
|
+
/*
|
|
305
|
+
case facebook::react::ImageResizeMode::None:
|
|
306
|
+
m_drawingSurface.Stretch(winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::None);
|
|
307
|
+
break;
|
|
308
|
+
*/
|
|
284
309
|
default:
|
|
285
310
|
assert(false);
|
|
286
311
|
}
|
|
@@ -71,6 +71,7 @@ struct ImageComponentView : ImageComponentViewT<ImageComponentView, ViewComponen
|
|
|
71
71
|
struct WindowsImageResponseObserver : facebook::react::ImageResponseObserver {
|
|
72
72
|
public:
|
|
73
73
|
WindowsImageResponseObserver(
|
|
74
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext,
|
|
74
75
|
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView> wkImage);
|
|
75
76
|
void didReceiveProgress(float progress, int64_t loaded, int64_t total) const override;
|
|
76
77
|
void didReceiveImage(const facebook::react::ImageResponse &imageResponse) const override;
|
|
@@ -78,6 +79,7 @@ struct ImageComponentView : ImageComponentViewT<ImageComponentView, ViewComponen
|
|
|
78
79
|
|
|
79
80
|
private:
|
|
80
81
|
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView> m_wkImage;
|
|
82
|
+
winrt::Microsoft::ReactNative::ReactContext m_reactContext;
|
|
81
83
|
};
|
|
82
84
|
|
|
83
85
|
void ensureDrawingSurface() noexcept;
|
|
@@ -85,6 +87,7 @@ struct ImageComponentView : ImageComponentViewT<ImageComponentView, ViewComponen
|
|
|
85
87
|
|
|
86
88
|
void ImageLoadStart() noexcept;
|
|
87
89
|
void ImageLoaded() noexcept;
|
|
90
|
+
void didReceiveProgress(float progress, int loaded, int total) noexcept;
|
|
88
91
|
void didReceiveImage(const std::shared_ptr<ImageResponseImage> &wicbmp) noexcept;
|
|
89
92
|
void didReceiveFailureFromObserver(const facebook::react::ImageLoadError &error) noexcept;
|
|
90
93
|
void setStateAndResubscribeImageResponseObserver(
|