Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcff3261

Browse files
[Fabric] Enable ShadowProps for all Fabric Components (#12108)
* extract shadow properties to baseComponentView* Change files* Change to updateShadowPropsCo-authored-by: Jon Thysell <thysell@gmail.com>---------Co-authored-by: Jon Thysell <thysell@gmail.com>
1 parentfc4ca0a commitcff3261

9 files changed

+36
-14
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type":"prerelease",
3+
"comment":"extract shadow properties to baseComponentView",
4+
"packageName":"react-native-windows",
5+
"email":"tatianakapos@microsoft.com",
6+
"dependentChangeType":"patch"
7+
}

‎vnext/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp‎

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,24 @@ void CompositionBaseComponentView::updateBorderProps(
10601060
}
10611061
}
10621062

1063+
voidCompositionBaseComponentView::updateShadowProps(
1064+
const facebook::react::ViewProps &oldViewProps,
1065+
const facebook::react::ViewProps &newViewProps,
1066+
winrt::Microsoft::ReactNative::Composition::ISpriteVisual m_visual)noexcept {
1067+
// Shadow Properties
1068+
if (oldViewProps.shadowOffset != newViewProps.shadowOffset || oldViewProps.shadowColor != newViewProps.shadowColor ||
1069+
oldViewProps.shadowOpacity != newViewProps.shadowOpacity ||
1070+
oldViewProps.shadowRadius != newViewProps.shadowRadius) {
1071+
auto shadow = m_compContext.CreateDropShadow();
1072+
shadow.Offset({newViewProps.shadowOffset.width, newViewProps.shadowOffset.height,0});
1073+
shadow.Opacity(newViewProps.shadowOpacity);
1074+
shadow.BlurRadius(newViewProps.shadowRadius);
1075+
if (newViewProps.shadowColor)
1076+
shadow.Color(newViewProps.shadowColor.AsWindowsColor());
1077+
m_visual.Shadow(shadow);
1078+
}
1079+
}
1080+
10631081
voidCompositionBaseComponentView::updateAccessibilityProps(
10641082
const facebook::react::ViewProps &oldViewProps,
10651083
const facebook::react::ViewProps &newViewProps)noexcept {
@@ -1288,19 +1306,7 @@ void CompositionViewComponentView::updateProps(
12881306

12891307
updateAccessibilityProps(oldViewProps, newViewProps);
12901308
updateBorderProps(oldViewProps, newViewProps);
1291-
1292-
// Shadow
1293-
if (oldViewProps.shadowOffset != newViewProps.shadowOffset || oldViewProps.shadowColor != newViewProps.shadowColor ||
1294-
oldViewProps.shadowOpacity != newViewProps.shadowOpacity ||
1295-
oldViewProps.shadowRadius != newViewProps.shadowRadius) {
1296-
auto shadow = m_compContext.CreateDropShadow();
1297-
shadow.Offset({newViewProps.shadowOffset.width, newViewProps.shadowOffset.height,0});
1298-
shadow.Opacity(newViewProps.shadowOpacity);
1299-
shadow.BlurRadius(newViewProps.shadowRadius);
1300-
if (newViewProps.shadowColor)
1301-
shadow.Color(newViewProps.shadowColor.AsWindowsColor());
1302-
m_visual.Shadow(shadow);
1303-
}
1309+
updateShadowProps(oldViewProps, newViewProps, m_visual);
13041310

13051311
if (oldViewProps.backfaceVisibility != newViewProps.backfaceVisibility) {
13061312
static_assert(

‎vnext/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ struct CompositionBaseComponentView : public IComponentView,
5050
voidupdateBorderProps(
5151
const facebook::react::ViewProps &oldViewProps,
5252
const facebook::react::ViewProps &newViewProps)noexcept;
53+
voidupdateShadowProps(
54+
const facebook::react::ViewProps &oldViewProps,
55+
const facebook::react::ViewProps &newViewProps,
56+
winrt::Microsoft::ReactNative::Composition::ISpriteVisual m_visual)noexcept;
5357
voidupdateAccessibilityProps(
5458
const facebook::react::ViewProps &oldView,
5559
const facebook::react::ViewProps &newViewProps)noexcept;

‎vnext/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ void ImageComponentView::updateProps(
108108

109109
ensureVisual();
110110

111+
updateShadowProps(oldImageProps, newImageProps, m_visual);
111112
updateBorderProps(oldImageProps, newImageProps);
112113

113114
if (oldImageProps.backgroundColor != newImageProps.backgroundColor ||

‎vnext/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ void ParagraphComponentView::updateProps(
5555
updateTextAlignment(newViewProps.textAttributes.alignment);
5656
}
5757

58+
updateShadowProps(oldViewProps, newViewProps, m_visual);
5859
updateAccessibilityProps(oldViewProps, newViewProps);
5960
updateBorderProps(oldViewProps, newViewProps);
6061

‎vnext/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ void ScrollViewComponentView::updateProps(
169169
}
170170
*/
171171

172+
updateShadowProps(oldViewProps, newViewProps, m_visual);
172173
updateBorderProps(oldViewProps, newViewProps);
173174
m_props = std::static_pointer_cast<facebook::react::ViewPropsconst>(props);
174175
}

‎vnext/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ struct ScrollInteractionTrackerOwner : public winrt::implements<
9090
voidupdateContentVisualSize()noexcept;
9191

9292
facebook::react::Size m_contentSize;
93-
winrt::Microsoft::ReactNative::Composition::IVisual m_visual{nullptr};
93+
winrt::Microsoft::ReactNative::Composition::ISpriteVisual m_visual{nullptr};
9494
winrt::Microsoft::ReactNative::Composition::IScrollVisual m_scrollVisual{nullptr};
9595
winrt::Microsoft::ReactNative::Composition::IScrollVisual::ScrollPositionChanged_revoker
9696
m_scrollPositionChangedRevoker{};

‎vnext/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void SwitchComponentView::updateProps(
5656
m_drawingSurface =nullptr;
5757
}
5858

59+
updateShadowProps(oldViewProps, newViewProps, m_visual);
5960
updateBorderProps(oldViewProps, newViewProps);
6061
m_props = std::static_pointer_cast<facebook::react::ViewPropsconst>(props);
6162
}

‎vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ void WindowsTextInputComponentView::updateProps(
609609

610610
ensureVisual();
611611

612+
updateShadowProps(oldTextInputProps, newTextInputProps, m_visual);
612613
updateBorderProps(oldTextInputProps, newTextInputProps);
613614

614615
if (!facebook::react::floatEquality(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp