Skip to content

Commit 1e5dea4

Browse files
authored
[0.81] Do not create m_childrenContainer when using a custom visual to mount children into (#15884)
* Do not create m_childrenContainer when using a custom visual to mount children into (#15877) * Do not create m_childrenContainer when using a custom visual to mount children into * Change files * fix * fix change file
1 parent 77bd4b1 commit 1e5dea4

6 files changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Do not create m_childrenContainer when using a custom visual to mount children into",
4+
"packageName": "react-native-windows",
5+
"email": "30809111+acoates-ms@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

vnext/Microsoft.ReactNative/Fabric/AbiViewProps.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ winrt::hstring ViewProps::AccessibilityLabel() noexcept {
226226
return m_viewProps ? winrt::to_hstring(m_viewProps->accessibilityLabel) : winrt::hstring{};
227227
}
228228

229+
winrt::Microsoft::ReactNative::Overflow ViewProps::Overflow() noexcept {
230+
return m_viewProps ? static_cast<winrt::Microsoft::ReactNative::Overflow>(m_viewProps->yogaStyle.overflow())
231+
: winrt::Microsoft::ReactNative::Overflow::Visible;
232+
}
233+
229234
ImageProps::ImageProps(facebook::react::SharedViewProps props) noexcept : Super(props) {}
230235

231236
winrt::Windows::Foundation::Collections::IVectorView<winrt::Microsoft::ReactNative::ImageSource>

vnext/Microsoft.ReactNative/Fabric/AbiViewProps.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ struct ViewProps : ViewPropsT<ViewProps> {
101101
winrt::Microsoft::ReactNative::Color BackgroundColor() noexcept;
102102
winrt::hstring TestId() noexcept;
103103
winrt::hstring AccessibilityLabel() noexcept;
104+
winrt::Microsoft::ReactNative::Overflow Overflow() noexcept;
104105

105106
protected:
106107
facebook::react::SharedViewProps m_props;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,10 @@ void ViewComponentView::updateLayoutMetrics(
13501350
void ViewComponentView::updateChildrenClippingPath(
13511351
facebook::react::LayoutMetrics const &layoutMetrics,
13521352
const facebook::react::ViewProps &viewProps) noexcept {
1353+
// Views with a custom visual to mount children into should to do their own handling of children clipping path
1354+
if (m_builder && m_builder->VisualToMountChildrenIntoHandler())
1355+
return;
1356+
13531357
const float scale = layoutMetrics.pointScaleFactor;
13541358
const float viewWidth = layoutMetrics.frame.size.width * scale;
13551359
const float viewHeight = layoutMetrics.frame.size.height * scale;

vnext/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ namespace Microsoft.ReactNative.Composition
7272
void SetCreateVisualHandler(CreateVisualDelegate impl);
7373
void SetViewFeatures(ComponentViewFeatures viewFeatures);
7474
void SetUpdateLayoutMetricsHandler(UpdateLayoutMetricsDelegate impl);
75+
76+
DOC_STRING("Provides a customized ContainerVisual that this components children will be mounted into. When overriding this, a clip is no longer automatically applied for overflow:\"hidden\"")
7577
void SetVisualToMountChildrenIntoHandler(VisualToMountChildrenIntoDelegate impl);
7678
};
7779

vnext/Microsoft.ReactNative/ViewProps.idl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ namespace Microsoft.ReactNative {
3232
static void WriteValue(IJSValueWriter writer, Color color);
3333
};
3434

35+
[experimental]
36+
enum Overflow
37+
{
38+
Visible,
39+
Hidden,
40+
Scroll,
41+
};
42+
3543
[webhosthidden]
3644
[experimental]
3745
DOC_STRING("Interface to implement custom view component properties.")
@@ -53,6 +61,7 @@ namespace Microsoft.ReactNative {
5361
Color BackgroundColor { get; };
5462
String TestId { get; };
5563
String AccessibilityLabel { get; };
64+
Overflow Overflow { get; };
5665

5766
// TODO add accessors to all the properties on ViewProps
5867
};

0 commit comments

Comments
 (0)