react-native-windows 0.75.0-preview.3 → 0.75.0-preview.5
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/Common/Common.vcxproj +1 -1
- package/Common/packages.lock.json +3 -3
- package/Folly/Folly.vcxproj +1 -1
- package/Folly/packages.lock.json +3 -3
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +26149 -15434
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +1630 -2675
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +1691 -2954
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +27069 -16192
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1657 -2714
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1733 -2980
- package/Libraries/Text/Text.windows.js +1 -0
- package/Microsoft.ReactNative/Composition.Input.idl +3 -3
- package/Microsoft.ReactNative/CompositionSwitcher.idl +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +4 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +10 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +16 -27
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +85 -48
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +19 -15
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +4 -2
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +10 -0
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +42 -17
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +3 -1
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +42 -5
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +22 -16
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +30 -6
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +2 -0
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +5 -0
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -1
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +3 -2
- package/PropertySheets/External/Microsoft.ReactNative.Composition.CppApp.targets +1 -1
- package/PropertySheets/External/Microsoft.ReactNative.Composition.CppLib.targets +2 -2
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/ReactCommon/ReactCommon.vcxproj +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/algorithm/CalculateLayout.cpp +2396 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.cpp +136 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.h +92 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.cpp +48 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.h +122 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/Node.cpp +388 -0
- package/ReactCommon/packages.lock.json +5 -5
- package/package.json +18 -18
|
@@ -298,6 +298,7 @@ const Text: React.AbstractComponent<
|
|
|
298
298
|
} else {
|
|
299
299
|
let styleProps: ViewStyleProp = (style: any);
|
|
300
300
|
if (
|
|
301
|
+
global.RN$Bridgeless !== true && // [Windows] Fabric text handles borders, but on paper we need to wrap it in an extra view
|
|
301
302
|
styleProps &&
|
|
302
303
|
styleProps.borderColor &&
|
|
303
304
|
(styleProps.borderWidth ||
|
|
@@ -8,7 +8,7 @@ namespace Microsoft.ReactNative.Composition.Input
|
|
|
8
8
|
{
|
|
9
9
|
interface KeyboardSource
|
|
10
10
|
{
|
|
11
|
-
|
|
11
|
+
Microsoft.UI.Input.VirtualKeyStates GetKeyState(Windows.System.VirtualKey key);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
interface RoutedEventArgs
|
|
@@ -21,14 +21,14 @@ namespace Microsoft.ReactNative.Composition.Input
|
|
|
21
21
|
String DeviceId { get; };
|
|
22
22
|
Boolean Handled { get; set; };
|
|
23
23
|
Windows.System.VirtualKey Key { get; };
|
|
24
|
-
|
|
24
|
+
Microsoft.UI.Input.PhysicalKeyStatus KeyStatus { get; };
|
|
25
25
|
Windows.System.VirtualKey OriginalKey { get; };
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
interface CharacterReceivedRoutedEventArgs requires RoutedEventArgs
|
|
29
29
|
{
|
|
30
30
|
Boolean Handled { get; set; };
|
|
31
|
-
|
|
31
|
+
Microsoft.UI.Input.PhysicalKeyStatus KeyStatus { get; };
|
|
32
32
|
Int32 KeyCode { get; };
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -106,6 +106,7 @@ namespace Microsoft.ReactNative.Composition.Experimental
|
|
|
106
106
|
interface IScrollVisual requires IVisual
|
|
107
107
|
{
|
|
108
108
|
void Brush(IBrush brush);
|
|
109
|
+
void ScrollEnabled(Boolean isScrollEnabled);
|
|
109
110
|
event Windows.Foundation.EventHandler<IScrollPositionChangedArgs> ScrollPositionChanged;
|
|
110
111
|
void ContentSize(Windows.Foundation.Numerics.Vector2 size);
|
|
111
112
|
Windows.Foundation.Numerics.Vector3 ScrollPosition { get; };
|
|
@@ -120,6 +120,9 @@ void ComponentViewRegistry::enqueueComponentViewWithComponentHandle(
|
|
|
120
120
|
ComponentViewDescriptor componentViewDescriptor) noexcept {
|
|
121
121
|
assert(m_registry.find(tag) != m_registry.end());
|
|
122
122
|
|
|
123
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(componentViewDescriptor.view)
|
|
124
|
+
->prepareForRecycle();
|
|
125
|
+
|
|
123
126
|
m_registry.erase(tag);
|
|
124
127
|
}
|
|
125
128
|
} // namespace Microsoft::ReactNative
|
|
@@ -68,7 +68,7 @@ winrt::Windows::System::VirtualKey KeyRoutedEventArgs::Key() noexcept {
|
|
|
68
68
|
return m_key;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
winrt::
|
|
71
|
+
winrt::Microsoft::UI::Input::PhysicalKeyStatus KeyRoutedEventArgs::KeyStatus() noexcept {
|
|
72
72
|
return m_keyStatus;
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -118,7 +118,7 @@ void CharacterReceivedRoutedEventArgs::Handled(bool value) noexcept {
|
|
|
118
118
|
int32_t CharacterReceivedRoutedEventArgs::KeyCode() noexcept {
|
|
119
119
|
return m_keycode;
|
|
120
120
|
}
|
|
121
|
-
winrt::
|
|
121
|
+
winrt::Microsoft::UI::Input::PhysicalKeyStatus CharacterReceivedRoutedEventArgs::KeyStatus() noexcept {
|
|
122
122
|
return m_keyStatus;
|
|
123
123
|
}
|
|
124
124
|
|
|
@@ -31,14 +31,14 @@ struct KeyRoutedEventArgs : winrt::implements<
|
|
|
31
31
|
bool Handled() noexcept;
|
|
32
32
|
void Handled(bool value) noexcept;
|
|
33
33
|
winrt::Windows::System::VirtualKey Key() noexcept;
|
|
34
|
-
winrt::
|
|
34
|
+
winrt::Microsoft::UI::Input::PhysicalKeyStatus KeyStatus() noexcept;
|
|
35
35
|
winrt::Windows::System::VirtualKey OriginalKey() noexcept;
|
|
36
36
|
|
|
37
37
|
private:
|
|
38
38
|
facebook::react::Tag m_tag{-1};
|
|
39
39
|
bool m_handled{false};
|
|
40
40
|
winrt::Windows::System::VirtualKey m_key;
|
|
41
|
-
winrt::
|
|
41
|
+
winrt::Microsoft::UI::Input::PhysicalKeyStatus m_keyStatus;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
struct CharacterReceivedRoutedEventArgs
|
|
@@ -57,13 +57,13 @@ struct CharacterReceivedRoutedEventArgs
|
|
|
57
57
|
bool Handled() noexcept;
|
|
58
58
|
void Handled(bool value) noexcept;
|
|
59
59
|
int32_t KeyCode() noexcept;
|
|
60
|
-
winrt::
|
|
60
|
+
winrt::Microsoft::UI::Input::PhysicalKeyStatus KeyStatus() noexcept;
|
|
61
61
|
|
|
62
62
|
private:
|
|
63
63
|
facebook::react::Tag m_tag{-1};
|
|
64
64
|
bool m_handled{false};
|
|
65
65
|
int32_t m_keycode;
|
|
66
|
-
winrt::
|
|
66
|
+
winrt::Microsoft::UI::Input::PhysicalKeyStatus m_keyStatus;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
struct Pointer : PointerT<Pointer> {
|
|
@@ -795,6 +795,16 @@ struct CompScrollerVisual : winrt::implements<
|
|
|
795
795
|
m_visual.Brush(TTypeRedirects::CompositionContextHelper::InnerBrush(brush));
|
|
796
796
|
}
|
|
797
797
|
|
|
798
|
+
void ScrollEnabled(bool isScrollEnabled) noexcept {
|
|
799
|
+
if (isScrollEnabled) {
|
|
800
|
+
m_visualInteractionSource.ManipulationRedirectionMode(
|
|
801
|
+
TTypeRedirects::VisualInteractionSourceRedirectionMode::CapableTouchpadAndPointerWheel);
|
|
802
|
+
} else {
|
|
803
|
+
m_visualInteractionSource.ManipulationRedirectionMode(
|
|
804
|
+
TTypeRedirects::VisualInteractionSourceRedirectionMode::Off);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
|
|
798
808
|
void Opacity(float opacity) noexcept {
|
|
799
809
|
m_visual.Opacity(opacity);
|
|
800
810
|
}
|
|
@@ -101,9 +101,9 @@ struct CompositionKeyboardSource
|
|
|
101
101
|
: winrt::implements<CompositionKeyboardSource, winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource> {
|
|
102
102
|
CompositionKeyboardSource(CompositionEventHandler *outer) : m_outer(outer) {}
|
|
103
103
|
|
|
104
|
-
winrt::
|
|
104
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates GetKeyState(winrt::Windows::System::VirtualKey key) noexcept {
|
|
105
105
|
if (!m_outer)
|
|
106
|
-
return winrt::
|
|
106
|
+
return winrt::Microsoft::UI::Input::VirtualKeyStates::None;
|
|
107
107
|
return m_outer->GetKeyState(key);
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -121,23 +121,11 @@ struct CompositionInputKeyboardSource : winrt::implements<
|
|
|
121
121
|
winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource> {
|
|
122
122
|
CompositionInputKeyboardSource(winrt::Microsoft::UI::Input::InputKeyboardSource source) : m_source(source) {}
|
|
123
123
|
|
|
124
|
-
winrt::
|
|
124
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates GetKeyState(winrt::Windows::System::VirtualKey key) noexcept {
|
|
125
125
|
if (!m_source)
|
|
126
|
-
return winrt::
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
static_cast<winrt::Windows::UI::Core::CoreVirtualKeyStates>(
|
|
130
|
-
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ==
|
|
131
|
-
winrt::Windows::UI::Core::CoreVirtualKeyStates::Down);
|
|
132
|
-
static_assert(
|
|
133
|
-
static_cast<winrt::Windows::UI::Core::CoreVirtualKeyStates>(
|
|
134
|
-
winrt::Microsoft::UI::Input::VirtualKeyStates::Locked) ==
|
|
135
|
-
winrt::Windows::UI::Core::CoreVirtualKeyStates::Locked);
|
|
136
|
-
static_assert(
|
|
137
|
-
static_cast<winrt::Windows::UI::Core::CoreVirtualKeyStates>(
|
|
138
|
-
winrt::Microsoft::UI::Input::VirtualKeyStates::None) ==
|
|
139
|
-
winrt::Windows::UI::Core::CoreVirtualKeyStates::None);
|
|
140
|
-
return static_cast<winrt::Windows::UI::Core::CoreVirtualKeyStates>(m_source.GetKeyState(key));
|
|
126
|
+
return winrt::Microsoft::UI::Input::VirtualKeyStates::None;
|
|
127
|
+
|
|
128
|
+
return m_source.GetKeyState(key);
|
|
141
129
|
}
|
|
142
130
|
|
|
143
131
|
void Disconnect() noexcept {
|
|
@@ -360,16 +348,15 @@ void CompositionEventHandler::onPointerWheelChanged(
|
|
|
360
348
|
}
|
|
361
349
|
}
|
|
362
350
|
|
|
363
|
-
winrt::
|
|
351
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates CompositionEventHandler::GetKeyState(
|
|
364
352
|
winrt::Windows::System::VirtualKey key) noexcept {
|
|
365
|
-
winrt::
|
|
353
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates coreKeyState = winrt::Microsoft::UI::Input::VirtualKeyStates::None;
|
|
366
354
|
SHORT keyState = ::GetKeyState(static_cast<int>(key));
|
|
367
355
|
if (keyState & 0x01) {
|
|
368
|
-
coreKeyState = winrt::
|
|
356
|
+
coreKeyState = winrt::Microsoft::UI::Input::VirtualKeyStates::Locked;
|
|
369
357
|
}
|
|
370
358
|
if (keyState & 0x8000) {
|
|
371
|
-
coreKeyState =
|
|
372
|
-
static_cast<int>(coreKeyState) | static_cast<int>(winrt::Windows::UI::Core::CoreVirtualKeyStates::Down));
|
|
359
|
+
coreKeyState = coreKeyState | winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
373
360
|
}
|
|
374
361
|
|
|
375
362
|
return coreKeyState;
|
|
@@ -510,10 +497,12 @@ void CompositionEventHandler::onKeyDown(
|
|
|
510
497
|
return;
|
|
511
498
|
}
|
|
512
499
|
|
|
513
|
-
bool fShift =
|
|
514
|
-
winrt::Windows::
|
|
515
|
-
|
|
516
|
-
|
|
500
|
+
bool fShift =
|
|
501
|
+
(source.GetKeyState(winrt::Windows::System::VirtualKey::Shift) &
|
|
502
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
503
|
+
bool fCtrl =
|
|
504
|
+
(source.GetKeyState(winrt::Windows::System::VirtualKey::Control) &
|
|
505
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
517
506
|
|
|
518
507
|
if (fShift && fCtrl && args.Key() == static_cast<winrt::Windows::System::VirtualKey>(VkKeyScanA('d')) &&
|
|
519
508
|
Mso::React::ReactOptions::UseDeveloperSupport(m_context.Properties().Handle())) {
|
|
@@ -36,7 +36,7 @@ class CompositionEventHandler {
|
|
|
36
36
|
|
|
37
37
|
int64_t SendMessage(HWND hwnd, uint32_t msg, uint64_t wParam, int64_t lParam) noexcept;
|
|
38
38
|
void RemoveTouchHandlers();
|
|
39
|
-
winrt::
|
|
39
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates GetKeyState(winrt::Windows::System::VirtualKey key) noexcept;
|
|
40
40
|
|
|
41
41
|
bool CapturePointer(
|
|
42
42
|
const winrt::Microsoft::ReactNative::Composition::Input::Pointer &pointer,
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
#include <Utils/ValueUtils.h>
|
|
17
17
|
#include <Views/FrameworkElementTransferProperties.h>
|
|
18
18
|
#include <winrt/Microsoft.ReactNative.Composition.Experimental.h>
|
|
19
|
+
#include <winrt/Microsoft.UI.Input.h>
|
|
19
20
|
#include <winrt/Windows.UI.Composition.h>
|
|
20
21
|
#include "CompositionContextHelper.h"
|
|
21
22
|
#include "CompositionDynamicAutomationProvider.h"
|
|
@@ -179,11 +180,46 @@ const facebook::react::LayoutMetrics &ComponentView::layoutMetrics() const noexc
|
|
|
179
180
|
return m_layoutMetrics;
|
|
180
181
|
}
|
|
181
182
|
|
|
183
|
+
void ComponentView::FinalizeTransform(
|
|
184
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
185
|
+
const facebook::react::ViewProps &viewProps) noexcept {
|
|
186
|
+
const auto resolveTransformMatrix = viewProps.resolveTransform(layoutMetrics);
|
|
187
|
+
winrt::Windows::Foundation::Numerics::float4x4 transformMatrix;
|
|
188
|
+
transformMatrix.m11 = resolveTransformMatrix.matrix[0];
|
|
189
|
+
transformMatrix.m12 = resolveTransformMatrix.matrix[1];
|
|
190
|
+
transformMatrix.m13 = resolveTransformMatrix.matrix[2];
|
|
191
|
+
transformMatrix.m14 = resolveTransformMatrix.matrix[3];
|
|
192
|
+
transformMatrix.m21 = resolveTransformMatrix.matrix[4];
|
|
193
|
+
transformMatrix.m22 = resolveTransformMatrix.matrix[5];
|
|
194
|
+
transformMatrix.m23 = resolveTransformMatrix.matrix[6];
|
|
195
|
+
transformMatrix.m24 = resolveTransformMatrix.matrix[7];
|
|
196
|
+
transformMatrix.m31 = resolveTransformMatrix.matrix[8];
|
|
197
|
+
transformMatrix.m32 = resolveTransformMatrix.matrix[9];
|
|
198
|
+
transformMatrix.m33 = resolveTransformMatrix.matrix[10];
|
|
199
|
+
transformMatrix.m34 = resolveTransformMatrix.matrix[11];
|
|
200
|
+
transformMatrix.m41 = resolveTransformMatrix.matrix[12];
|
|
201
|
+
transformMatrix.m42 = resolveTransformMatrix.matrix[13];
|
|
202
|
+
transformMatrix.m43 = resolveTransformMatrix.matrix[14];
|
|
203
|
+
transformMatrix.m44 = resolveTransformMatrix.matrix[15];
|
|
204
|
+
|
|
205
|
+
auto centerPointPropSet = EnsureCenterPointPropertySet();
|
|
206
|
+
if (centerPointPropSet) {
|
|
207
|
+
centerPointPropSet.InsertMatrix4x4(L"transform", transformMatrix);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
EnsureTransformMatrixFacade();
|
|
211
|
+
m_FinalizeTransform = false;
|
|
212
|
+
}
|
|
213
|
+
|
|
182
214
|
void ComponentView::FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask updateMask) noexcept {
|
|
183
215
|
if ((m_flags & ComponentViewFeatures::NativeBorder) == ComponentViewFeatures::NativeBorder) {
|
|
184
216
|
finalizeBorderUpdates(m_layoutMetrics, *viewProps());
|
|
185
217
|
}
|
|
186
218
|
|
|
219
|
+
if (m_FinalizeTransform) {
|
|
220
|
+
FinalizeTransform(m_layoutMetrics, *viewProps());
|
|
221
|
+
}
|
|
222
|
+
|
|
187
223
|
base_type::FinalizeUpdates(updateMask);
|
|
188
224
|
}
|
|
189
225
|
|
|
@@ -602,6 +638,8 @@ void SetBorderLayerPropertiesCommon(
|
|
|
602
638
|
facebook::react::BorderStyle borderStyle) {
|
|
603
639
|
layer.Offset({anchorOffset.x, anchorOffset.y, 0}, {anchorPoint.x, anchorPoint.y, 0});
|
|
604
640
|
layer.RelativeSizeWithOffset(size, relativeSizeAdjustment);
|
|
641
|
+
layer.as<::Microsoft::ReactNative::Composition::Experimental::IVisualInterop>()->SetClippingPath(nullptr);
|
|
642
|
+
|
|
605
643
|
if ((textureRect.right - textureRect.left) <= 0 || (textureRect.bottom - textureRect.top) <= 0)
|
|
606
644
|
return;
|
|
607
645
|
|
|
@@ -703,7 +741,8 @@ void SetBorderLayerProperties(
|
|
|
703
741
|
// if (VisualVersion::IsUseWinCompClippingRegionEnabled())
|
|
704
742
|
{
|
|
705
743
|
layer.Offset({anchorOffset.x, anchorOffset.y, 0}, {anchorPoint.x, anchorPoint.y, 0});
|
|
706
|
-
layer.
|
|
744
|
+
layer.RelativeSizeWithOffset(
|
|
745
|
+
{textureRect.right - textureRect.left, textureRect.bottom - textureRect.top}, {0.0f, 0.0f});
|
|
707
746
|
|
|
708
747
|
layer.Brush(theme->Brush(*borderColor));
|
|
709
748
|
|
|
@@ -1242,30 +1281,7 @@ void ComponentView::updateTransformProps(
|
|
|
1242
1281
|
|
|
1243
1282
|
// Transform - TODO doesn't handle multiple of the same kind of transform -- Doesn't handle hittesting updates
|
|
1244
1283
|
if (oldViewProps.transform != newViewProps.transform) {
|
|
1245
|
-
|
|
1246
|
-
transformMatrix.m11 = newViewProps.transform.matrix[0];
|
|
1247
|
-
transformMatrix.m12 = newViewProps.transform.matrix[1];
|
|
1248
|
-
transformMatrix.m13 = newViewProps.transform.matrix[2];
|
|
1249
|
-
transformMatrix.m14 = newViewProps.transform.matrix[3];
|
|
1250
|
-
transformMatrix.m21 = newViewProps.transform.matrix[4];
|
|
1251
|
-
transformMatrix.m22 = newViewProps.transform.matrix[5];
|
|
1252
|
-
transformMatrix.m23 = newViewProps.transform.matrix[6];
|
|
1253
|
-
transformMatrix.m24 = newViewProps.transform.matrix[7];
|
|
1254
|
-
transformMatrix.m31 = newViewProps.transform.matrix[8];
|
|
1255
|
-
transformMatrix.m32 = newViewProps.transform.matrix[9];
|
|
1256
|
-
transformMatrix.m33 = newViewProps.transform.matrix[10];
|
|
1257
|
-
transformMatrix.m34 = newViewProps.transform.matrix[11];
|
|
1258
|
-
transformMatrix.m41 = newViewProps.transform.matrix[12];
|
|
1259
|
-
transformMatrix.m42 = newViewProps.transform.matrix[13];
|
|
1260
|
-
transformMatrix.m43 = newViewProps.transform.matrix[14];
|
|
1261
|
-
transformMatrix.m44 = newViewProps.transform.matrix[15];
|
|
1262
|
-
|
|
1263
|
-
auto centerPointPropSet = EnsureCenterPointPropertySet();
|
|
1264
|
-
if (centerPointPropSet) {
|
|
1265
|
-
centerPointPropSet.InsertMatrix4x4(L"transform", transformMatrix);
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
EnsureTransformMatrixFacade();
|
|
1284
|
+
m_FinalizeTransform = true;
|
|
1269
1285
|
}
|
|
1270
1286
|
}
|
|
1271
1287
|
|
|
@@ -1614,7 +1630,10 @@ inline winrt::Windows::System::VirtualKey GetLeftOrRightModifiedKey(
|
|
|
1614
1630
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
1615
1631
|
winrt::Windows::System::VirtualKey leftKey,
|
|
1616
1632
|
winrt::Windows::System::VirtualKey rightKey) {
|
|
1617
|
-
return (source.GetKeyState(leftKey)
|
|
1633
|
+
return ((source.GetKeyState(leftKey) & winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ==
|
|
1634
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down)
|
|
1635
|
+
? leftKey
|
|
1636
|
+
: rightKey;
|
|
1618
1637
|
}
|
|
1619
1638
|
|
|
1620
1639
|
std::string CodeFromVirtualKey(
|
|
@@ -1647,16 +1666,20 @@ void ViewComponentView::OnKeyDown(
|
|
|
1647
1666
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
1648
1667
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept {
|
|
1649
1668
|
auto eventCode = CodeFromVirtualKey(source, args.Key());
|
|
1650
|
-
bool fShift =
|
|
1651
|
-
winrt::Windows::
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
bool
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1669
|
+
bool fShift =
|
|
1670
|
+
(source.GetKeyState(winrt::Windows::System::VirtualKey::Shift) &
|
|
1671
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
1672
|
+
bool fAlt =
|
|
1673
|
+
(source.GetKeyState(winrt::Windows::System::VirtualKey::Menu) &
|
|
1674
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
1675
|
+
bool fCtrl =
|
|
1676
|
+
(source.GetKeyState(winrt::Windows::System::VirtualKey::Control) &
|
|
1677
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
1678
|
+
bool fMeta =
|
|
1679
|
+
((source.GetKeyState(winrt::Windows::System::VirtualKey::LeftWindows) &
|
|
1680
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ||
|
|
1681
|
+
((source.GetKeyState(winrt::Windows::System::VirtualKey::RightWindows) &
|
|
1682
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down);
|
|
1660
1683
|
|
|
1661
1684
|
if (args.OriginalSource() == Tag() && !args.Handled()) {
|
|
1662
1685
|
facebook::react::KeyEvent event;
|
|
@@ -1665,7 +1688,12 @@ void ViewComponentView::OnKeyDown(
|
|
|
1665
1688
|
event.altKey = fAlt;
|
|
1666
1689
|
event.metaKey = fMeta;
|
|
1667
1690
|
|
|
1668
|
-
event.key = ::Microsoft::ReactNative::FromVirtualKey(
|
|
1691
|
+
event.key = ::Microsoft::ReactNative::FromVirtualKey(
|
|
1692
|
+
args.Key(),
|
|
1693
|
+
event.shiftKey,
|
|
1694
|
+
!!((source.GetKeyState(winrt::Windows::System::VirtualKey::CapitalLock) &
|
|
1695
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Locked) ==
|
|
1696
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Locked));
|
|
1669
1697
|
event.code = eventCode;
|
|
1670
1698
|
m_eventEmitter->onKeyDown(event);
|
|
1671
1699
|
}
|
|
@@ -1686,16 +1714,20 @@ void ViewComponentView::OnKeyUp(
|
|
|
1686
1714
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
1687
1715
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept {
|
|
1688
1716
|
auto eventCode = CodeFromVirtualKey(source, args.Key());
|
|
1689
|
-
bool fShift =
|
|
1690
|
-
winrt::Windows::
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
bool
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1717
|
+
bool fShift =
|
|
1718
|
+
(source.GetKeyState(winrt::Windows::System::VirtualKey::Shift) &
|
|
1719
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
1720
|
+
bool fAlt =
|
|
1721
|
+
(source.GetKeyState(winrt::Windows::System::VirtualKey::Menu) &
|
|
1722
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
1723
|
+
bool fCtrl =
|
|
1724
|
+
(source.GetKeyState(winrt::Windows::System::VirtualKey::Control) &
|
|
1725
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
1726
|
+
bool fMeta =
|
|
1727
|
+
((source.GetKeyState(winrt::Windows::System::VirtualKey::LeftWindows) &
|
|
1728
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ||
|
|
1729
|
+
((source.GetKeyState(winrt::Windows::System::VirtualKey::RightWindows) &
|
|
1730
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down);
|
|
1699
1731
|
|
|
1700
1732
|
if (args.OriginalSource() == Tag()) {
|
|
1701
1733
|
facebook::react::KeyEvent event;
|
|
@@ -1704,7 +1736,12 @@ void ViewComponentView::OnKeyUp(
|
|
|
1704
1736
|
event.altKey = fAlt;
|
|
1705
1737
|
event.metaKey = fMeta;
|
|
1706
1738
|
|
|
1707
|
-
event.key = ::Microsoft::ReactNative::FromVirtualKey(
|
|
1739
|
+
event.key = ::Microsoft::ReactNative::FromVirtualKey(
|
|
1740
|
+
args.Key(),
|
|
1741
|
+
event.shiftKey,
|
|
1742
|
+
!!((source.GetKeyState(winrt::Windows::System::VirtualKey::CapitalLock) &
|
|
1743
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ==
|
|
1744
|
+
winrt::Microsoft::UI::Input::VirtualKeyStates::Down));
|
|
1708
1745
|
event.code = eventCode;
|
|
1709
1746
|
m_eventEmitter->onKeyUp(event);
|
|
1710
1747
|
}
|
|
@@ -168,7 +168,11 @@ struct ComponentView
|
|
|
168
168
|
std::array<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual, SpecialBorderLayerCount>
|
|
169
169
|
FindSpecialBorderLayers() const noexcept;
|
|
170
170
|
void UpdateCenterPropertySet() noexcept;
|
|
171
|
+
void FinalizeTransform(
|
|
172
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
173
|
+
const facebook::react::ViewProps &viewProps) noexcept;
|
|
171
174
|
|
|
175
|
+
bool m_FinalizeTransform{false};
|
|
172
176
|
ComponentViewFeatures m_flags;
|
|
173
177
|
void showFocusVisual(bool show) noexcept;
|
|
174
178
|
winrt::Microsoft::ReactNative::Composition::Experimental::IFocusVisual m_focusVisual{nullptr};
|
|
@@ -30,9 +30,9 @@ extern "C" HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT SDKVersion, IWICIma
|
|
|
30
30
|
|
|
31
31
|
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
32
32
|
|
|
33
|
-
ImageComponentView::WindowsImageResponseObserver::WindowsImageResponseObserver(
|
|
34
|
-
|
|
35
|
-
}
|
|
33
|
+
ImageComponentView::WindowsImageResponseObserver::WindowsImageResponseObserver(
|
|
34
|
+
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView> wkImage)
|
|
35
|
+
: m_wkImage(std::move(wkImage)) {}
|
|
36
36
|
|
|
37
37
|
void ImageComponentView::WindowsImageResponseObserver::didReceiveProgress(float progress, int64_t loaded, int64_t total)
|
|
38
38
|
const {
|
|
@@ -41,14 +41,21 @@ void ImageComponentView::WindowsImageResponseObserver::didReceiveProgress(float
|
|
|
41
41
|
|
|
42
42
|
void ImageComponentView::WindowsImageResponseObserver::didReceiveImage(
|
|
43
43
|
facebook::react::ImageResponse const &imageResponse) const {
|
|
44
|
-
auto
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
if (auto imgComponentView{m_wkImage.get()}) {
|
|
45
|
+
auto imageResponseImage = std::static_pointer_cast<ImageResponseImage>(imageResponse.getImage());
|
|
46
|
+
imgComponentView->m_reactContext.UIDispatcher().Post([imageResponseImage, wkImage = m_wkImage]() {
|
|
47
|
+
if (auto image{wkImage.get()}) {
|
|
48
|
+
image->didReceiveImage(imageResponseImage);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
void ImageComponentView::WindowsImageResponseObserver::didReceiveFailure(
|
|
50
55
|
facebook::react::ImageLoadError const &error) const {
|
|
51
|
-
|
|
56
|
+
if (auto imgComponentView{m_wkImage.get()}) {
|
|
57
|
+
imgComponentView->didReceiveFailureFromObserver(error);
|
|
58
|
+
}
|
|
52
59
|
}
|
|
53
60
|
|
|
54
61
|
facebook::react::SharedViewProps ImageComponentView::defaultProps() noexcept {
|
|
@@ -146,14 +153,7 @@ void ImageComponentView::updateState(
|
|
|
146
153
|
auto newImageState = std::static_pointer_cast<facebook::react::ImageShadowNode::ConcreteState const>(state);
|
|
147
154
|
|
|
148
155
|
if (!m_imageResponseObserver) {
|
|
149
|
-
|
|
150
|
-
std::shared_ptr<::Microsoft::ReactNative::FabricUIManager> fabricuiManager =
|
|
151
|
-
::Microsoft::ReactNative::FabricUIManager::FromProperties(m_reactContext.Properties());
|
|
152
|
-
auto componentViewDescriptor = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(m_tag);
|
|
153
|
-
|
|
154
|
-
m_imageResponseObserver = std::make_shared<WindowsImageResponseObserver>(
|
|
155
|
-
*componentViewDescriptor.view
|
|
156
|
-
.as<winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView>());
|
|
156
|
+
m_imageResponseObserver = std::make_shared<WindowsImageResponseObserver>(get_weak());
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
setStateAndResubscribeImageResponseObserver(newImageState);
|
|
@@ -182,6 +182,10 @@ void ImageComponentView::setStateAndResubscribeImageResponseObserver(
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
+
void ImageComponentView::prepareForRecycle() noexcept {
|
|
186
|
+
setStateAndResubscribeImageResponseObserver(nullptr);
|
|
187
|
+
}
|
|
188
|
+
|
|
185
189
|
winrt::Microsoft::ReactNative::ImageProps ImageComponentView::ImageProps() noexcept {
|
|
186
190
|
// We do not currently support custom ImageComponentView's
|
|
187
191
|
// If we did we would need to create a AbiImageProps and possibly return them here
|
|
@@ -47,6 +47,7 @@ struct ImageComponentView : ImageComponentViewT<ImageComponentView, ViewComponen
|
|
|
47
47
|
override;
|
|
48
48
|
void updateState(facebook::react::State::Shared const &state, facebook::react::State::Shared const &oldState) noexcept
|
|
49
49
|
override;
|
|
50
|
+
void prepareForRecycle() noexcept override;
|
|
50
51
|
void OnRenderingDeviceLost() noexcept override;
|
|
51
52
|
void onThemeChanged() noexcept override;
|
|
52
53
|
|
|
@@ -69,13 +70,14 @@ struct ImageComponentView : ImageComponentViewT<ImageComponentView, ViewComponen
|
|
|
69
70
|
private:
|
|
70
71
|
struct WindowsImageResponseObserver : facebook::react::ImageResponseObserver {
|
|
71
72
|
public:
|
|
72
|
-
WindowsImageResponseObserver(
|
|
73
|
+
WindowsImageResponseObserver(
|
|
74
|
+
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView> wkImage);
|
|
73
75
|
void didReceiveProgress(float progress, int64_t loaded, int64_t total) const override;
|
|
74
76
|
void didReceiveImage(const facebook::react::ImageResponse &imageResponse) const override;
|
|
75
77
|
void didReceiveFailure(const facebook::react::ImageLoadError &error) const override;
|
|
76
78
|
|
|
77
79
|
private:
|
|
78
|
-
winrt::
|
|
80
|
+
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView> m_wkImage;
|
|
79
81
|
};
|
|
80
82
|
|
|
81
83
|
void ensureDrawingSurface() noexcept;
|
|
@@ -83,6 +83,16 @@ void ParagraphComponentView::updateState(
|
|
|
83
83
|
m_textLayout = nullptr;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
void ParagraphComponentView::updateLayoutMetrics(
|
|
87
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
88
|
+
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept {
|
|
89
|
+
Super::updateLayoutMetrics(layoutMetrics, oldLayoutMetrics);
|
|
90
|
+
|
|
91
|
+
if (layoutMetrics.pointScaleFactor != oldLayoutMetrics.pointScaleFactor) {
|
|
92
|
+
m_textLayout = nullptr;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
86
96
|
void ParagraphComponentView::FinalizeUpdates(
|
|
87
97
|
winrt::Microsoft::ReactNative::ComponentViewUpdateMask updateMask) noexcept {
|
|
88
98
|
ensureVisual();
|
|
@@ -34,6 +34,9 @@ struct ParagraphComponentView : ParagraphComponentViewT<ParagraphComponentView,
|
|
|
34
34
|
void updateProps(facebook::react::Props::Shared const &props, facebook::react::Props::Shared const &oldProps) noexcept
|
|
35
35
|
override;
|
|
36
36
|
void updateEventEmitter(facebook::react::EventEmitter::Shared const &eventEmitter) noexcept override;
|
|
37
|
+
void updateLayoutMetrics(
|
|
38
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
39
|
+
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept override;
|
|
37
40
|
void updateState(facebook::react::State::Shared const &state, facebook::react::State::Shared const &oldState) noexcept
|
|
38
41
|
override;
|
|
39
42
|
void FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask updateMask) noexcept override;
|