react-native-windows 0.74.0-preview.2 → 0.74.0-preview.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Image/AssetSourceResolver.windows.js +186 -0
- package/Libraries/Image/assetPaths.js +36 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +18 -3
- package/Microsoft.ReactNative/CompositionContext.idl +5 -5
- package/Microsoft.ReactNative/CompositionRootView.idl +22 -8
- package/Microsoft.ReactNative/CompositionSwitcher.idl +2 -2
- package/Microsoft.ReactNative/CompositionUIService.idl +8 -6
- package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +8 -1
- package/Microsoft.ReactNative/Fabric/AbiViewProps.h +7 -2
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +4 -3
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.h +5 -5
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +173 -152
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.h +8 -8
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper_emptyimpl.cpp +13 -13
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHelpers.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +14 -11
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.cpp +24 -11
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.h +15 -10
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView_emptyimpl.cpp +15 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService.cpp +20 -9
- package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService.h +6 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService_emptyimpl.cpp +5 -2
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +104 -54
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +25 -19
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.h +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +9 -8
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +5 -5
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +7 -5
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +5 -5
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +4 -4
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +5 -5
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +5 -2
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +34 -27
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +6 -6
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +9 -9
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +6 -6
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +5 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +6 -6
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +13 -3
- package/Microsoft.ReactNative/Fabric/Composition/Theme.h +16 -8
- package/Microsoft.ReactNative/Fabric/Composition/Theme_emptyimpl.cpp +3 -3
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +3 -3
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.h +3 -3
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +1 -1
- package/Microsoft.ReactNative/Fabric/IComponentViewRegistry.h +1 -1
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +2 -1
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +7 -5
- package/Microsoft.ReactNative/Theme.idl +12 -1
- package/Microsoft.ReactNative/ViewProps.idl +11 -1
- package/Microsoft.ReactNative/packages.lock.json +70 -42
- package/Microsoft.ReactNative.Cxx/AutoDraw.h +3 -3
- package/Microsoft.ReactNative.Cxx/{CompositionSwitcher.interop.h → CompositionSwitcher.Experimental.interop.h} +2 -2
- package/Microsoft.ReactNative.Cxx/DesktopWindowBridge.h +2 -0
- package/Microsoft.ReactNative.Managed/Microsoft.ReactNative.Managed.csproj +2 -11
- package/PropertySheets/External/Microsoft.ReactNative.Composition.CppApp.props +1 -1
- package/PropertySheets/External/Microsoft.ReactNative.WindowsSdk.Default.props +5 -3
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/package.json +11 -11
- package/templates/cpp-app/windows/MyApp/MyApp.cpp +2 -7
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
#include <Utils/KeyboardUtils.h>
|
|
15
15
|
#include <Utils/ValueUtils.h>
|
|
16
16
|
#include <Views/FrameworkElementTransferProperties.h>
|
|
17
|
+
#include <winrt/Microsoft.ReactNative.Composition.Experimental.h>
|
|
17
18
|
#include <winrt/Windows.UI.Composition.h>
|
|
18
19
|
#include "CompositionContextHelper.h"
|
|
19
20
|
#include "CompositionDynamicAutomationProvider.h"
|
|
@@ -31,11 +32,15 @@ namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
|
31
32
|
CreateCompositionComponentViewArgs::CreateCompositionComponentViewArgs(
|
|
32
33
|
const winrt::Microsoft::ReactNative::IReactContext &reactContext,
|
|
33
34
|
facebook::react::Tag tag,
|
|
34
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compositionContext)
|
|
35
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compositionContext)
|
|
35
36
|
: base_type(reactContext, tag), m_compositionContext(compositionContext){};
|
|
36
37
|
|
|
37
|
-
winrt::Microsoft::
|
|
38
|
-
|
|
38
|
+
winrt::Microsoft::UI::Composition::Compositor CreateCompositionComponentViewArgs::Compositor() const noexcept {
|
|
39
|
+
return winrt::Microsoft::ReactNative::Composition::CompositionUIService::GetCompositor(ReactContext().Properties());
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext
|
|
43
|
+
CreateCompositionComponentViewArgs::CompositionContext() const noexcept {
|
|
39
44
|
return m_compositionContext;
|
|
40
45
|
}
|
|
41
46
|
|
|
@@ -48,10 +53,17 @@ void CreateCompositionComponentViewArgs::Features(ComponentViewFeatures value) n
|
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
ComponentView::ComponentView(const winrt::Microsoft::ReactNative::Composition::CreateCompositionComponentViewArgs &args)
|
|
51
|
-
: ComponentView(
|
|
56
|
+
: ComponentView(
|
|
57
|
+
winrt::get_self<
|
|
58
|
+
winrt::Microsoft::ReactNative::Composition::implementation::CreateCompositionComponentViewArgs>(args)
|
|
59
|
+
->CompositionContext(),
|
|
60
|
+
args.Tag(),
|
|
61
|
+
args.ReactContext(),
|
|
62
|
+
args.Features(),
|
|
63
|
+
true) {}
|
|
52
64
|
|
|
53
65
|
ComponentView::ComponentView(
|
|
54
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
66
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
55
67
|
facebook::react::Tag tag,
|
|
56
68
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext,
|
|
57
69
|
ComponentViewFeatures flags,
|
|
@@ -74,9 +86,9 @@ facebook::react::Props::Shared ComponentView::props() noexcept {
|
|
|
74
86
|
void ComponentView::onThemeChanged() noexcept {
|
|
75
87
|
if ((m_flags & ComponentViewFeatures::Background) == ComponentViewFeatures::Background) {
|
|
76
88
|
if (viewProps()->backgroundColor) {
|
|
77
|
-
Visual().as<ISpriteVisual>().Brush(theme()->Brush(*viewProps()->backgroundColor));
|
|
89
|
+
Visual().as<Experimental::ISpriteVisual>().Brush(theme()->Brush(*viewProps()->backgroundColor));
|
|
78
90
|
} else {
|
|
79
|
-
Visual().as<ISpriteVisual>().Brush(nullptr);
|
|
91
|
+
Visual().as<Experimental::ISpriteVisual>().Brush(nullptr);
|
|
80
92
|
}
|
|
81
93
|
}
|
|
82
94
|
|
|
@@ -108,7 +120,13 @@ winrt::Microsoft::ReactNative::Composition::Theme ComponentView::Theme() const n
|
|
|
108
120
|
return theme()->get_strong().as<winrt::Microsoft::ReactNative::Composition::Theme>();
|
|
109
121
|
}
|
|
110
122
|
|
|
111
|
-
winrt::Microsoft::
|
|
123
|
+
winrt::Microsoft::UI::Composition::Compositor ComponentView::Compositor() const noexcept {
|
|
124
|
+
return winrt::Microsoft::ReactNative::Composition::Experimental::MicrosoftCompositionContextHelper::InnerCompositor(
|
|
125
|
+
m_compContext);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext ComponentView::CompositionContext()
|
|
129
|
+
const noexcept {
|
|
112
130
|
return m_compContext;
|
|
113
131
|
}
|
|
114
132
|
|
|
@@ -121,9 +139,9 @@ void ComponentView::updateProps(
|
|
|
121
139
|
if ((m_flags & ComponentViewFeatures::Background) == ComponentViewFeatures::Background) {
|
|
122
140
|
if (oldViewProps.backgroundColor != newViewProps.backgroundColor) {
|
|
123
141
|
if (newViewProps.backgroundColor) {
|
|
124
|
-
Visual().as<ISpriteVisual>().Brush(theme()->Brush(*newViewProps.backgroundColor));
|
|
142
|
+
Visual().as<Experimental::ISpriteVisual>().Brush(theme()->Brush(*newViewProps.backgroundColor));
|
|
125
143
|
} else {
|
|
126
|
-
Visual().as<ISpriteVisual>().Brush(nullptr);
|
|
144
|
+
Visual().as<Experimental::ISpriteVisual>().Brush(nullptr);
|
|
127
145
|
}
|
|
128
146
|
}
|
|
129
147
|
}
|
|
@@ -295,15 +313,17 @@ const facebook::react::SharedViewEventEmitter &ComponentView::GetEventEmitter()
|
|
|
295
313
|
return m_eventEmitter;
|
|
296
314
|
}
|
|
297
315
|
|
|
298
|
-
std::array<
|
|
316
|
+
std::array<
|
|
317
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual,
|
|
318
|
+
ComponentView::SpecialBorderLayerCount>
|
|
299
319
|
ComponentView::FindSpecialBorderLayers() const noexcept {
|
|
300
|
-
std::array<winrt::Microsoft::ReactNative::Composition::ISpriteVisual, SpecialBorderLayerCount> layers{
|
|
320
|
+
std::array<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual, SpecialBorderLayerCount> layers{
|
|
301
321
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
|
|
302
322
|
|
|
303
323
|
if (m_numBorderVisuals) {
|
|
304
324
|
for (uint8_t i = 0; i < m_numBorderVisuals; i++) {
|
|
305
325
|
auto visual = Visual().GetAt(i);
|
|
306
|
-
layers[i] = visual.as<winrt::Microsoft::ReactNative::Composition::ISpriteVisual>();
|
|
326
|
+
layers[i] = visual.as<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual>();
|
|
307
327
|
}
|
|
308
328
|
}
|
|
309
329
|
|
|
@@ -328,12 +348,13 @@ struct RoundedPathParameters {
|
|
|
328
348
|
* right, bottom right, bottom left). "rectPathGeometry" defines the bounding box of the generated shape.
|
|
329
349
|
*/
|
|
330
350
|
static winrt::com_ptr<ID2D1PathGeometry> GenerateRoundedRectPathGeometry(
|
|
331
|
-
winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
351
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
332
352
|
const RoundedPathParameters ¶ms,
|
|
333
353
|
const facebook::react::RectangleEdges<float> &rectPathGeometry) noexcept {
|
|
334
354
|
winrt::com_ptr<ID2D1PathGeometry> pathGeometry;
|
|
335
355
|
winrt::com_ptr<ID2D1Factory1> spD2dFactory;
|
|
336
|
-
compContext.as<::Microsoft::ReactNative::Composition::ICompositionContextInterop>()->D2DFactory(
|
|
356
|
+
compContext.as<::Microsoft::ReactNative::Composition::Experimental::ICompositionContextInterop>()->D2DFactory(
|
|
357
|
+
spD2dFactory.put());
|
|
337
358
|
|
|
338
359
|
// Create a path geometry.
|
|
339
360
|
HRESULT hr = spD2dFactory->CreatePathGeometry(pathGeometry.put());
|
|
@@ -513,7 +534,7 @@ RoundedPathParameters GenerateRoundedPathParameters(
|
|
|
513
534
|
}
|
|
514
535
|
|
|
515
536
|
static winrt::com_ptr<ID2D1PathGeometry> GenerateRoundedRectPathGeometry(
|
|
516
|
-
winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
537
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
517
538
|
const facebook::react::RectangleCorners<float> &baseRadius,
|
|
518
539
|
const facebook::react::RectangleEdges<float> &inset,
|
|
519
540
|
const facebook::react::RectangleEdges<float> &rectPathGeometry) noexcept {
|
|
@@ -548,7 +569,8 @@ void DrawShape(
|
|
|
548
569
|
}
|
|
549
570
|
|
|
550
571
|
struct AutoDrawHelper {
|
|
551
|
-
AutoDrawHelper(
|
|
572
|
+
AutoDrawHelper(
|
|
573
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::Experimental::ICompositionDrawingSurfaceInterop> &surface) {
|
|
552
574
|
m_surface = surface;
|
|
553
575
|
m_surface->BeginDraw(m_pRT.put(), &m_offset);
|
|
554
576
|
}
|
|
@@ -566,7 +588,7 @@ struct AutoDrawHelper {
|
|
|
566
588
|
}
|
|
567
589
|
|
|
568
590
|
private:
|
|
569
|
-
winrt::com_ptr<::Microsoft::ReactNative::Composition::ICompositionDrawingSurfaceInterop> m_surface;
|
|
591
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::Experimental::ICompositionDrawingSurfaceInterop> m_surface;
|
|
570
592
|
POINT m_offset;
|
|
571
593
|
winrt::com_ptr<ID2D1DeviceContext> m_pRT;
|
|
572
594
|
};
|
|
@@ -574,10 +596,11 @@ struct AutoDrawHelper {
|
|
|
574
596
|
template <typename TShape>
|
|
575
597
|
void SetBorderLayerPropertiesCommon(
|
|
576
598
|
winrt::Microsoft::ReactNative::Composition::implementation::Theme *theme,
|
|
577
|
-
winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
578
|
-
winrt::Microsoft::ReactNative::Composition::ISpriteVisual &layer,
|
|
599
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
600
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual &layer,
|
|
579
601
|
TShape &shape,
|
|
580
|
-
winrt::com_ptr<::Microsoft::ReactNative::Composition::ICompositionDrawingSurfaceInterop>
|
|
602
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::Experimental::ICompositionDrawingSurfaceInterop>
|
|
603
|
+
&borderTexture,
|
|
581
604
|
const D2D1_RECT_F &textureRect,
|
|
582
605
|
facebook::react::Point anchorPoint,
|
|
583
606
|
facebook::react::Point anchorOffset,
|
|
@@ -664,10 +687,11 @@ void SetBorderLayerPropertiesCommon(
|
|
|
664
687
|
template <typename TShape>
|
|
665
688
|
void SetBorderLayerProperties(
|
|
666
689
|
winrt::Microsoft::ReactNative::Composition::implementation::Theme *theme,
|
|
667
|
-
winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
668
|
-
winrt::Microsoft::ReactNative::Composition::ISpriteVisual &layer,
|
|
690
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
691
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual &layer,
|
|
669
692
|
TShape &shape,
|
|
670
|
-
winrt::com_ptr<::Microsoft::ReactNative::Composition::ICompositionDrawingSurfaceInterop>
|
|
693
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::Experimental::ICompositionDrawingSurfaceInterop>
|
|
694
|
+
&borderTexture,
|
|
671
695
|
const D2D1_RECT_F &textureRect,
|
|
672
696
|
facebook::react::Point anchorPoint,
|
|
673
697
|
facebook::react::Point anchorOffset,
|
|
@@ -700,7 +724,7 @@ void SetBorderLayerProperties(
|
|
|
700
724
|
layer.Brush(theme->Brush(*borderColor));
|
|
701
725
|
|
|
702
726
|
winrt::com_ptr<ID2D1Factory1> spD2dFactory;
|
|
703
|
-
compContext.as<::Microsoft::ReactNative::Composition::ICompositionContextInterop>()->D2DFactory(
|
|
727
|
+
compContext.as<::Microsoft::ReactNative::Composition::Experimental::ICompositionContextInterop>()->D2DFactory(
|
|
704
728
|
spD2dFactory.put());
|
|
705
729
|
|
|
706
730
|
winrt::com_ptr<ID2D1TransformedGeometry> transformedShape;
|
|
@@ -708,7 +732,8 @@ void SetBorderLayerProperties(
|
|
|
708
732
|
winrt::check_hresult(
|
|
709
733
|
spD2dFactory->CreateTransformedGeometry(&shape, &translationTransform, transformedShape.put()));
|
|
710
734
|
|
|
711
|
-
layer.as<::Microsoft::ReactNative::Composition::IVisualInterop>()->SetClippingPath(
|
|
735
|
+
layer.as<::Microsoft::ReactNative::Composition::Experimental::IVisualInterop>()->SetClippingPath(
|
|
736
|
+
transformedShape.get());
|
|
712
737
|
}
|
|
713
738
|
/*
|
|
714
739
|
else
|
|
@@ -731,9 +756,10 @@ const float Bottom = 1.0;
|
|
|
731
756
|
template <typename TShape>
|
|
732
757
|
void DrawAllBorderLayers(
|
|
733
758
|
winrt::Microsoft::ReactNative::Composition::implementation::Theme *theme,
|
|
734
|
-
winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
735
|
-
std::array<
|
|
736
|
-
|
|
759
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
760
|
+
std::array<
|
|
761
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual,
|
|
762
|
+
ComponentView::SpecialBorderLayerCount> &spBorderLayers,
|
|
737
763
|
TShape &shape,
|
|
738
764
|
const facebook::react::BorderWidths &borderWidths,
|
|
739
765
|
const facebook::react::BorderRadii &borderRadii,
|
|
@@ -742,7 +768,7 @@ void DrawAllBorderLayers(
|
|
|
742
768
|
const facebook::react::BorderColors &borderColors,
|
|
743
769
|
facebook::react::BorderStyle borderStyle) {
|
|
744
770
|
// Now that we've drawn our nice border in one layer, split it into its component layers
|
|
745
|
-
winrt::com_ptr<::Microsoft::ReactNative::Composition::ICompositionDrawingSurfaceInterop>
|
|
771
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::Experimental::ICompositionDrawingSurfaceInterop>
|
|
746
772
|
spTextures[ComponentView::SpecialBorderLayerCount];
|
|
747
773
|
|
|
748
774
|
// Set component border properties
|
|
@@ -903,7 +929,7 @@ void DrawAllBorderLayers(
|
|
|
903
929
|
}
|
|
904
930
|
|
|
905
931
|
winrt::com_ptr<ID2D1GeometryGroup> GetGeometryForRoundedBorder(
|
|
906
|
-
winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
932
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
907
933
|
const facebook::react::RectangleCorners<float> &radius,
|
|
908
934
|
const facebook::react::RectangleEdges<float> &inset,
|
|
909
935
|
const facebook::react::RectangleEdges<float> &thickness,
|
|
@@ -956,7 +982,8 @@ winrt::com_ptr<ID2D1GeometryGroup> GetGeometryForRoundedBorder(
|
|
|
956
982
|
|
|
957
983
|
ID2D1Geometry *ppGeometries[] = {outerPathGeometry.get(), innerPathGeometry.get()};
|
|
958
984
|
winrt::com_ptr<ID2D1Factory1> spD2dFactory;
|
|
959
|
-
compContext.as<::Microsoft::ReactNative::Composition::ICompositionContextInterop>()->D2DFactory(
|
|
985
|
+
compContext.as<::Microsoft::ReactNative::Composition::Experimental::ICompositionContextInterop>()->D2DFactory(
|
|
986
|
+
spD2dFactory.put());
|
|
960
987
|
|
|
961
988
|
winrt::com_ptr<ID2D1GeometryGroup> geometryGroup = nullptr;
|
|
962
989
|
// Create a geometry group.
|
|
@@ -1036,7 +1063,8 @@ facebook::react::BorderMetrics resolveAndAlignBorderMetrics(
|
|
|
1036
1063
|
|
|
1037
1064
|
bool ComponentView::TryUpdateSpecialBorderLayers(
|
|
1038
1065
|
winrt::Microsoft::ReactNative::Composition::implementation::Theme *theme,
|
|
1039
|
-
std::array<winrt::Microsoft::ReactNative::Composition::ISpriteVisual, SpecialBorderLayerCount>
|
|
1066
|
+
std::array<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual, SpecialBorderLayerCount>
|
|
1067
|
+
&spBorderVisuals,
|
|
1040
1068
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
1041
1069
|
const facebook::react::ViewProps &viewProps) noexcept {
|
|
1042
1070
|
auto borderMetrics = resolveAndAlignBorderMetrics(layoutMetrics, viewProps);
|
|
@@ -1150,13 +1178,13 @@ void ComponentView::finalizeBorderUpdates(
|
|
|
1150
1178
|
if (!TryUpdateSpecialBorderLayers(theme(), spBorderLayers, layoutMetrics, viewProps)) {
|
|
1151
1179
|
for (auto &spBorderLayer : spBorderLayers) {
|
|
1152
1180
|
if (spBorderLayer) {
|
|
1153
|
-
spBorderLayer.as<winrt::Microsoft::ReactNative::Composition::ISpriteVisual>().Brush(nullptr);
|
|
1181
|
+
spBorderLayer.as<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual>().Brush(nullptr);
|
|
1154
1182
|
}
|
|
1155
1183
|
}
|
|
1156
1184
|
}
|
|
1157
1185
|
}
|
|
1158
1186
|
|
|
1159
|
-
winrt::Microsoft::ReactNative::Composition::IVisual ComponentView::OuterVisual() const noexcept {
|
|
1187
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual ComponentView::OuterVisual() const noexcept {
|
|
1160
1188
|
return m_outerVisual ? m_outerVisual : Visual();
|
|
1161
1189
|
}
|
|
1162
1190
|
|
|
@@ -1203,29 +1231,29 @@ void ComponentView::applyShadowProps(const facebook::react::ViewProps &viewProps
|
|
|
1203
1231
|
shadow.BlurRadius(viewProps.shadowRadius);
|
|
1204
1232
|
if (viewProps.shadowColor)
|
|
1205
1233
|
shadow.Color(theme()->Color(*viewProps.shadowColor));
|
|
1206
|
-
Visual().as<winrt::Microsoft::ReactNative::Composition::ISpriteVisual>().Shadow(shadow);
|
|
1234
|
+
Visual().as<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual>().Shadow(shadow);
|
|
1207
1235
|
}
|
|
1208
1236
|
|
|
1209
1237
|
void ComponentView::updateTransformProps(
|
|
1210
1238
|
const facebook::react::ViewProps &oldViewProps,
|
|
1211
1239
|
const facebook::react::ViewProps &newViewProps,
|
|
1212
|
-
winrt::Microsoft::ReactNative::Composition::IVisual visual) noexcept {
|
|
1240
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual visual) noexcept {
|
|
1213
1241
|
// check for backfaceVisibility prop
|
|
1214
1242
|
if (oldViewProps.backfaceVisibility != newViewProps.backfaceVisibility) {
|
|
1215
1243
|
static_assert(
|
|
1216
1244
|
static_cast<facebook::react::BackfaceVisibility>(
|
|
1217
|
-
winrt::Microsoft::ReactNative::Composition::BackfaceVisibility::Inherit) ==
|
|
1245
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::BackfaceVisibility::Inherit) ==
|
|
1218
1246
|
facebook::react::BackfaceVisibility::Auto);
|
|
1219
1247
|
static_assert(
|
|
1220
1248
|
static_cast<facebook::react::BackfaceVisibility>(
|
|
1221
|
-
winrt::Microsoft::ReactNative::Composition::BackfaceVisibility::Visible) ==
|
|
1249
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::BackfaceVisibility::Visible) ==
|
|
1222
1250
|
facebook::react::BackfaceVisibility::Visible);
|
|
1223
1251
|
static_assert(
|
|
1224
1252
|
static_cast<facebook::react::BackfaceVisibility>(
|
|
1225
|
-
winrt::Microsoft::ReactNative::Composition::BackfaceVisibility::Hidden) ==
|
|
1253
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::BackfaceVisibility::Hidden) ==
|
|
1226
1254
|
facebook::react::BackfaceVisibility::Hidden);
|
|
1227
|
-
visual.BackfaceVisibility(
|
|
1228
|
-
|
|
1255
|
+
visual.BackfaceVisibility(static_cast<winrt::Microsoft::ReactNative::Composition::Experimental::BackfaceVisibility>(
|
|
1256
|
+
newViewProps.backfaceVisibility));
|
|
1229
1257
|
}
|
|
1230
1258
|
|
|
1231
1259
|
// Transform - TODO doesn't handle multiple of the same kind of transform -- Doesn't handle hittesting updates
|
|
@@ -1316,7 +1344,7 @@ void ComponentView::updateBorderLayoutMetrics(
|
|
|
1316
1344
|
|
|
1317
1345
|
if (borderMetrics.borderRadii.topLeft == 0 && borderMetrics.borderRadii.topRight == 0 &&
|
|
1318
1346
|
borderMetrics.borderRadii.bottomLeft == 0 && borderMetrics.borderRadii.bottomRight == 0) {
|
|
1319
|
-
Visual().as<::Microsoft::ReactNative::Composition::IVisualInterop>()->SetClippingPath(nullptr);
|
|
1347
|
+
Visual().as<::Microsoft::ReactNative::Composition::Experimental::IVisualInterop>()->SetClippingPath(nullptr);
|
|
1320
1348
|
} else {
|
|
1321
1349
|
winrt::com_ptr<ID2D1PathGeometry> pathGeometry = GenerateRoundedRectPathGeometry(
|
|
1322
1350
|
m_compContext,
|
|
@@ -1327,7 +1355,8 @@ void ComponentView::updateBorderLayoutMetrics(
|
|
|
1327
1355
|
layoutMetrics.frame.size.width * layoutMetrics.pointScaleFactor,
|
|
1328
1356
|
layoutMetrics.frame.size.height * layoutMetrics.pointScaleFactor});
|
|
1329
1357
|
|
|
1330
|
-
Visual().as<::Microsoft::ReactNative::Composition::IVisualInterop>()->SetClippingPath(
|
|
1358
|
+
Visual().as<::Microsoft::ReactNative::Composition::Experimental::IVisualInterop>()->SetClippingPath(
|
|
1359
|
+
pathGeometry.get());
|
|
1331
1360
|
}
|
|
1332
1361
|
|
|
1333
1362
|
if (m_layoutMetrics != layoutMetrics) {
|
|
@@ -1359,7 +1388,8 @@ ComponentView::supplementalComponentDescriptorProviders() noexcept {
|
|
|
1359
1388
|
comp::CompositionPropertySet ComponentView::EnsureCenterPointPropertySet() noexcept {
|
|
1360
1389
|
if (m_centerPropSet == nullptr) {
|
|
1361
1390
|
if (auto compositor =
|
|
1362
|
-
winrt::Microsoft::ReactNative::Composition::CompositionContextHelper::InnerCompositor(
|
|
1391
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::CompositionContextHelper::InnerCompositor(
|
|
1392
|
+
m_compContext)) {
|
|
1363
1393
|
m_centerPropSet = compositor.CreatePropertySet();
|
|
1364
1394
|
UpdateCenterPropertySet();
|
|
1365
1395
|
m_centerPropSet.InsertMatrix4x4(L"transform", winrt::Windows::Foundation::Numerics::float4x4::identity());
|
|
@@ -1404,12 +1434,13 @@ void ComponentView::EnsureTransformMatrixFacade() noexcept {
|
|
|
1404
1434
|
|
|
1405
1435
|
auto centerPointPropSet = EnsureCenterPointPropertySet();
|
|
1406
1436
|
if (auto compositor =
|
|
1407
|
-
winrt::Microsoft::ReactNative::Composition::CompositionContextHelper::InnerCompositor(
|
|
1437
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::CompositionContextHelper::InnerCompositor(
|
|
1438
|
+
m_compContext)) {
|
|
1408
1439
|
// TODO cache expression instead of creating new ones all the time
|
|
1409
1440
|
auto expression = compositor.CreateExpressionAnimation(
|
|
1410
1441
|
L"Matrix4x4.CreateFromScale(PS.dpiScale3Inv) * Matrix4x4.CreateFromTranslation(PS.translation) * PS.transform * Matrix4x4.CreateFromScale(PS.dpiScale3)");
|
|
1411
1442
|
expression.SetReferenceParameter(L"PS", centerPointPropSet);
|
|
1412
|
-
winrt::Microsoft::ReactNative::Composition::CompositionContextHelper::InnerVisual(OuterVisual())
|
|
1443
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::CompositionContextHelper::InnerVisual(OuterVisual())
|
|
1413
1444
|
.StartAnimation(L"TransformMatrix", expression);
|
|
1414
1445
|
}
|
|
1415
1446
|
}
|
|
@@ -1454,10 +1485,17 @@ std::string ComponentView::DefaultHelpText() const noexcept {
|
|
|
1454
1485
|
|
|
1455
1486
|
ViewComponentView::ViewComponentView(
|
|
1456
1487
|
const winrt::Microsoft::ReactNative::Composition::CreateCompositionComponentViewArgs &args)
|
|
1457
|
-
: ViewComponentView(
|
|
1488
|
+
: ViewComponentView(
|
|
1489
|
+
winrt::get_self<
|
|
1490
|
+
winrt::Microsoft::ReactNative::Composition::implementation::CreateCompositionComponentViewArgs>(args)
|
|
1491
|
+
->CompositionContext(),
|
|
1492
|
+
args.Tag(),
|
|
1493
|
+
args.ReactContext(),
|
|
1494
|
+
args.Features(),
|
|
1495
|
+
true) {}
|
|
1458
1496
|
|
|
1459
1497
|
ViewComponentView::ViewComponentView(
|
|
1460
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
1498
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
1461
1499
|
facebook::react::Tag tag,
|
|
1462
1500
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext,
|
|
1463
1501
|
ComponentViewFeatures flags,
|
|
@@ -1467,25 +1505,37 @@ ViewComponentView::ViewComponentView(
|
|
|
1467
1505
|
m_props = defaultProps;
|
|
1468
1506
|
}
|
|
1469
1507
|
|
|
1470
|
-
winrt::Microsoft::ReactNative::Composition::IVisual ViewComponentView::
|
|
1508
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual ViewComponentView::createVisual() noexcept {
|
|
1471
1509
|
return m_compContext.CreateSpriteVisual();
|
|
1472
1510
|
}
|
|
1473
1511
|
|
|
1512
|
+
winrt::Microsoft::UI::Composition::Visual ViewComponentView::CreateVisual() noexcept {
|
|
1513
|
+
return winrt::Microsoft::ReactNative::Composition::Experimental::MicrosoftCompositionContextHelper::InnerVisual(
|
|
1514
|
+
createVisual());
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1474
1517
|
void ViewComponentView::ensureVisual() noexcept {
|
|
1475
1518
|
if (!m_visual) {
|
|
1476
1519
|
if (m_customComponent) {
|
|
1477
1520
|
// Review is it expected that I need this cast to call overridden methods?
|
|
1478
1521
|
winrt::Microsoft::ReactNative::Composition::ViewComponentView outer(*this);
|
|
1479
|
-
|
|
1522
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IInternalCreateVisual internalCreateVisual{nullptr};
|
|
1523
|
+
if (outer.try_as(internalCreateVisual)) {
|
|
1524
|
+
m_visual = internalCreateVisual.CreateInternalVisual();
|
|
1525
|
+
} else {
|
|
1526
|
+
m_visual =
|
|
1527
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::MicrosoftCompositionContextHelper::CreateVisual(
|
|
1528
|
+
outer.CreateVisual());
|
|
1529
|
+
}
|
|
1480
1530
|
} else {
|
|
1481
|
-
m_visual =
|
|
1531
|
+
m_visual = createVisual();
|
|
1482
1532
|
}
|
|
1483
1533
|
OuterVisual().InsertAt(m_visual, 0);
|
|
1484
1534
|
}
|
|
1485
1535
|
}
|
|
1486
1536
|
|
|
1487
1537
|
winrt::Microsoft::ReactNative::ComponentView ViewComponentView::Create(
|
|
1488
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
1538
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
1489
1539
|
facebook::react::Tag tag,
|
|
1490
1540
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept {
|
|
1491
1541
|
return winrt::make<ViewComponentView>(compContext, tag, reactContext, ComponentViewFeatures::Default, false);
|
|
@@ -1679,7 +1729,7 @@ winrt::Microsoft::ReactNative::ViewProps ViewComponentView::ViewProps() noexcept
|
|
|
1679
1729
|
return winrt::make<winrt::Microsoft::ReactNative::implementation::ViewProps>(m_props);
|
|
1680
1730
|
}
|
|
1681
1731
|
|
|
1682
|
-
winrt::Microsoft::ReactNative::Composition::IVisual ViewComponentView::Visual() const noexcept {
|
|
1732
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual ViewComponentView::Visual() const noexcept {
|
|
1683
1733
|
assert(m_visual);
|
|
1684
1734
|
return m_visual;
|
|
1685
1735
|
}
|
|
@@ -27,16 +27,18 @@ struct CreateCompositionComponentViewArgs
|
|
|
27
27
|
CreateCompositionComponentViewArgs(
|
|
28
28
|
const winrt::Microsoft::ReactNative::IReactContext &reactContext,
|
|
29
29
|
facebook::react::Tag tag,
|
|
30
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compositionContext);
|
|
30
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compositionContext);
|
|
31
31
|
|
|
32
|
-
winrt::Microsoft::
|
|
32
|
+
winrt::Microsoft::UI::Composition::Compositor Compositor() const noexcept;
|
|
33
|
+
|
|
34
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext CompositionContext() const noexcept;
|
|
33
35
|
|
|
34
36
|
ComponentViewFeatures Features() const noexcept;
|
|
35
37
|
void Features(ComponentViewFeatures value) noexcept;
|
|
36
38
|
|
|
37
39
|
private:
|
|
38
40
|
ComponentViewFeatures m_features{ComponentViewFeatures::Default};
|
|
39
|
-
winrt::Microsoft::ReactNative::Composition::ICompositionContext m_compositionContext;
|
|
41
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext m_compositionContext;
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
struct ComponentView
|
|
@@ -45,17 +47,17 @@ struct ComponentView
|
|
|
45
47
|
|
|
46
48
|
ComponentView(winrt::Microsoft::ReactNative::Composition::CreateCompositionComponentViewArgs const &args);
|
|
47
49
|
ComponentView(
|
|
48
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
50
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
49
51
|
facebook::react::Tag tag,
|
|
50
52
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext,
|
|
51
53
|
ComponentViewFeatures flags,
|
|
52
54
|
bool customControl);
|
|
53
55
|
|
|
54
|
-
virtual winrt::Microsoft::ReactNative::Composition::IVisual Visual() const noexcept {
|
|
56
|
+
virtual winrt::Microsoft::ReactNative::Composition::Experimental::IVisual Visual() const noexcept {
|
|
55
57
|
return nullptr;
|
|
56
58
|
};
|
|
57
59
|
// Visual that should be parented to this ComponentView's parent
|
|
58
|
-
virtual winrt::Microsoft::ReactNative::Composition::IVisual OuterVisual() const noexcept;
|
|
60
|
+
virtual winrt::Microsoft::ReactNative::Composition::Experimental::IVisual OuterVisual() const noexcept;
|
|
59
61
|
void updateEventEmitter(facebook::react::EventEmitter::Shared const &eventEmitter) noexcept override;
|
|
60
62
|
const facebook::react::SharedViewEventEmitter &GetEventEmitter() const noexcept;
|
|
61
63
|
void HandleCommand(winrt::hstring commandName, const winrt::Microsoft::ReactNative::IJSValueReader &args) noexcept
|
|
@@ -94,7 +96,7 @@ struct ComponentView
|
|
|
94
96
|
void updateTransformProps(
|
|
95
97
|
const facebook::react::ViewProps &oldViewProps,
|
|
96
98
|
const facebook::react::ViewProps &newViewProps,
|
|
97
|
-
winrt::Microsoft::ReactNative::Composition::IVisual m_visual) noexcept;
|
|
99
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual m_visual) noexcept;
|
|
98
100
|
void updateAccessibilityProps(
|
|
99
101
|
const facebook::react::ViewProps &oldView,
|
|
100
102
|
const facebook::react::ViewProps &newViewProps) noexcept;
|
|
@@ -116,7 +118,8 @@ struct ComponentView
|
|
|
116
118
|
virtual std::string DefaultAccessibleName() const noexcept;
|
|
117
119
|
virtual std::string DefaultHelpText() const noexcept;
|
|
118
120
|
|
|
119
|
-
winrt::Microsoft::
|
|
121
|
+
winrt::Microsoft::UI::Composition::Compositor Compositor() const noexcept;
|
|
122
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext CompositionContext() const noexcept;
|
|
120
123
|
|
|
121
124
|
// Publicaly overridable APIs
|
|
122
125
|
void FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask updateMask) noexcept override;
|
|
@@ -129,7 +132,7 @@ struct ComponentView
|
|
|
129
132
|
facebook::react::Point &localPt) const noexcept;
|
|
130
133
|
|
|
131
134
|
winrt::IInspectable m_uiaProvider{nullptr};
|
|
132
|
-
winrt::Microsoft::ReactNative::Composition::ICompositionContext m_compContext;
|
|
135
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext m_compContext;
|
|
133
136
|
comp::CompositionPropertySet m_centerPropSet{nullptr};
|
|
134
137
|
facebook::react::SharedViewEventEmitter m_eventEmitter;
|
|
135
138
|
facebook::react::LayoutMetrics m_layoutMetrics;
|
|
@@ -150,23 +153,24 @@ struct ComponentView
|
|
|
150
153
|
const facebook::react::ViewProps &viewProps) noexcept;
|
|
151
154
|
bool TryUpdateSpecialBorderLayers(
|
|
152
155
|
winrt::Microsoft::ReactNative::Composition::implementation::Theme *theme,
|
|
153
|
-
std::array<winrt::Microsoft::ReactNative::Composition::ISpriteVisual, SpecialBorderLayerCount>
|
|
156
|
+
std::array<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual, SpecialBorderLayerCount>
|
|
157
|
+
&spBorderVisuals,
|
|
154
158
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
155
159
|
const facebook::react::ViewProps &viewProps) noexcept;
|
|
156
|
-
std::array<winrt::Microsoft::ReactNative::Composition::ISpriteVisual, SpecialBorderLayerCount>
|
|
160
|
+
std::array<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual, SpecialBorderLayerCount>
|
|
157
161
|
FindSpecialBorderLayers() const noexcept;
|
|
158
162
|
void UpdateCenterPropertySet() noexcept;
|
|
159
163
|
|
|
160
164
|
ComponentViewFeatures m_flags;
|
|
161
165
|
void showFocusVisual(bool show) noexcept;
|
|
162
|
-
winrt::Microsoft::ReactNative::Composition::IFocusVisual m_focusVisual{nullptr};
|
|
163
|
-
winrt::Microsoft::ReactNative::Composition::IVisual m_outerVisual{nullptr};
|
|
166
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IFocusVisual m_focusVisual{nullptr};
|
|
167
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual m_outerVisual{nullptr};
|
|
164
168
|
};
|
|
165
169
|
|
|
166
170
|
struct ViewComponentView : public ViewComponentViewT<ViewComponentView, ComponentView> {
|
|
167
171
|
ViewComponentView(winrt::Microsoft::ReactNative::Composition::CreateCompositionComponentViewArgs const &args);
|
|
168
172
|
[[nodiscard]] static winrt::Microsoft::ReactNative::ComponentView Create(
|
|
169
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
173
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
170
174
|
facebook::react::Tag tag,
|
|
171
175
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept;
|
|
172
176
|
|
|
@@ -200,23 +204,25 @@ struct ViewComponentView : public ViewComponentViewT<ViewComponentView, Componen
|
|
|
200
204
|
bool ignorePointerEvents = false) const noexcept override;
|
|
201
205
|
const winrt::Microsoft::ReactNative::IComponentProps userProps(
|
|
202
206
|
facebook::react::Props::Shared const &props) noexcept override;
|
|
203
|
-
winrt::Microsoft::ReactNative::Composition::IVisual Visual() const noexcept override;
|
|
207
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual Visual() const noexcept override;
|
|
204
208
|
void ensureVisual() noexcept;
|
|
205
209
|
|
|
206
210
|
ViewComponentView(
|
|
207
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
211
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
208
212
|
facebook::react::Tag tag,
|
|
209
213
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext,
|
|
210
214
|
ComponentViewFeatures flags,
|
|
211
215
|
bool customComponent);
|
|
212
216
|
|
|
213
|
-
|
|
214
|
-
|
|
217
|
+
virtual winrt::Microsoft::ReactNative::Composition::Experimental::IVisual createVisual() noexcept;
|
|
218
|
+
|
|
219
|
+
// Publicly overridable APIs
|
|
220
|
+
virtual winrt::Microsoft::UI::Composition::Visual CreateVisual() noexcept;
|
|
215
221
|
virtual void UpdateLayoutMetrics(const LayoutMetrics &metrics, const LayoutMetrics &oldMetrics) noexcept;
|
|
216
222
|
|
|
217
223
|
private:
|
|
218
224
|
facebook::react::SharedViewProps m_props;
|
|
219
|
-
winrt::Microsoft::ReactNative::Composition::IVisual m_visual{nullptr};
|
|
225
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual m_visual{nullptr};
|
|
220
226
|
};
|
|
221
227
|
|
|
222
228
|
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
12
12
|
|
|
13
13
|
DebuggingOverlayComponentView::DebuggingOverlayComponentView(
|
|
14
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
14
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
15
15
|
facebook::react::Tag tag,
|
|
16
16
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext)
|
|
17
17
|
: base_type(
|
|
@@ -38,7 +38,7 @@ void DebuggingOverlayComponentView::UnmountChildComponentView(
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
winrt::Microsoft::ReactNative::ComponentView DebuggingOverlayComponentView::Create(
|
|
41
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
41
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
42
42
|
facebook::react::Tag tag,
|
|
43
43
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept {
|
|
44
44
|
return winrt::make<DebuggingOverlayComponentView>(compContext, tag, reactContext);
|
|
@@ -13,7 +13,7 @@ namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
|
13
13
|
struct DebuggingOverlayComponentView
|
|
14
14
|
: DebuggingOverlayComponentViewT<DebuggingOverlayComponentView, ViewComponentView> {
|
|
15
15
|
[[nodiscard]] static winrt::Microsoft::ReactNative::ComponentView Create(
|
|
16
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
16
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
17
17
|
facebook::react::Tag tag,
|
|
18
18
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept;
|
|
19
19
|
|
|
@@ -25,7 +25,7 @@ struct DebuggingOverlayComponentView
|
|
|
25
25
|
uint32_t index) noexcept override;
|
|
26
26
|
|
|
27
27
|
DebuggingOverlayComponentView(
|
|
28
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
28
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
29
29
|
facebook::react::Tag tag,
|
|
30
30
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext);
|
|
31
31
|
|
|
@@ -49,7 +49,7 @@ void ImageComponentView::WindowsImageResponseObserver::didReceiveFailure() const
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
ImageComponentView::ImageComponentView(
|
|
52
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
52
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
53
53
|
facebook::react::Tag tag,
|
|
54
54
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext)
|
|
55
55
|
: Super(
|
|
@@ -244,13 +244,14 @@ void ImageComponentView::ensureDrawingSurface() noexcept {
|
|
|
244
244
|
|
|
245
245
|
switch (imageProps->resizeMode) {
|
|
246
246
|
case facebook::react::ImageResizeMode::Stretch:
|
|
247
|
-
m_drawingSurface.Stretch(winrt::Microsoft::ReactNative::Composition::CompositionStretch::Fill);
|
|
247
|
+
m_drawingSurface.Stretch(winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::Fill);
|
|
248
248
|
break;
|
|
249
249
|
case facebook::react::ImageResizeMode::Cover:
|
|
250
|
-
m_drawingSurface.Stretch(
|
|
250
|
+
m_drawingSurface.Stretch(
|
|
251
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::UniformToFill);
|
|
251
252
|
break;
|
|
252
253
|
case facebook::react::ImageResizeMode::Contain:
|
|
253
|
-
m_drawingSurface.Stretch(winrt::Microsoft::ReactNative::Composition::CompositionStretch::Uniform);
|
|
254
|
+
m_drawingSurface.Stretch(winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::Uniform);
|
|
254
255
|
break;
|
|
255
256
|
case facebook::react::ImageResizeMode::Repeat:
|
|
256
257
|
// TODO - set AlignmentRatio back to 0.5f when switching between resizeModes once we no longer recreate the
|
|
@@ -262,8 +263,8 @@ void ImageComponentView::ensureDrawingSurface() noexcept {
|
|
|
262
263
|
case facebook::react::ImageResizeMode::Center: {
|
|
263
264
|
m_drawingSurface.Stretch(
|
|
264
265
|
(height < frame.height && width < frame.width)
|
|
265
|
-
? winrt::Microsoft::ReactNative::Composition::CompositionStretch::None
|
|
266
|
-
: winrt::Microsoft::ReactNative::Composition::CompositionStretch::Uniform);
|
|
266
|
+
? winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::None
|
|
267
|
+
: winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::Uniform);
|
|
267
268
|
break;
|
|
268
269
|
}
|
|
269
270
|
default:
|
|
@@ -416,7 +417,7 @@ void ImageComponentView::ensureVisual() noexcept {
|
|
|
416
417
|
}
|
|
417
418
|
}
|
|
418
419
|
|
|
419
|
-
winrt::Microsoft::ReactNative::Composition::IVisual ImageComponentView::Visual() const noexcept {
|
|
420
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual ImageComponentView::Visual() const noexcept {
|
|
420
421
|
return m_visual;
|
|
421
422
|
}
|
|
422
423
|
|
|
@@ -429,7 +430,7 @@ std::string ImageComponentView::DefaultControlType() const noexcept {
|
|
|
429
430
|
}
|
|
430
431
|
|
|
431
432
|
winrt::Microsoft::ReactNative::ComponentView ImageComponentView::Create(
|
|
432
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionContext &compContext,
|
|
433
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
433
434
|
facebook::react::Tag tag,
|
|
434
435
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept {
|
|
435
436
|
return winrt::make<ImageComponentView>(compContext, tag, reactContext);
|