Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Do not create m_childrenContainer when using a custom visual to mount children into",
"packageName": "react-native-windows",
"email": "30809111+acoates-ms@users.noreply.github.com",
"dependentChangeType": "patch"
}
5 changes: 5 additions & 0 deletions vnext/Microsoft.ReactNative/Fabric/AbiViewProps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ winrt::hstring ViewProps::AccessibilityLabel() noexcept {
return m_viewProps ? winrt::to_hstring(m_viewProps->accessibilityLabel) : winrt::hstring{};
}

winrt::Microsoft::ReactNative::Overflow ViewProps::Overflow() noexcept {
return m_viewProps ? static_cast<winrt::Microsoft::ReactNative::Overflow>(m_viewProps->yogaStyle.overflow())
: winrt::Microsoft::ReactNative::Overflow::Visible;
}

ImageProps::ImageProps(facebook::react::SharedViewProps props) noexcept : Super(props) {}

winrt::Windows::Foundation::Collections::IVectorView<winrt::Microsoft::ReactNative::ImageSource>
Expand Down
1 change: 1 addition & 0 deletions vnext/Microsoft.ReactNative/Fabric/AbiViewProps.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ struct ViewProps : ViewPropsT<ViewProps> {
winrt::Microsoft::ReactNative::Color BackgroundColor() noexcept;
winrt::hstring TestId() noexcept;
winrt::hstring AccessibilityLabel() noexcept;
winrt::Microsoft::ReactNative::Overflow Overflow() noexcept;

protected:
facebook::react::SharedViewProps m_props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,10 @@ void ViewComponentView::updateLayoutMetrics(
void ViewComponentView::updateChildrenClippingPath(
facebook::react::LayoutMetrics const &layoutMetrics,
const facebook::react::ViewProps &viewProps) noexcept {
// Views with a custom visual to mount children into should to do their own handling of children clipping path
if (m_builder && m_builder->VisualToMountChildrenIntoHandler())
return;

const float scale = layoutMetrics.pointScaleFactor;
const float viewWidth = layoutMetrics.frame.size.width * scale;
const float viewHeight = layoutMetrics.frame.size.height * scale;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ namespace Microsoft.ReactNative.Composition
void SetCreateVisualHandler(CreateVisualDelegate impl);
void SetViewFeatures(ComponentViewFeatures viewFeatures);
void SetUpdateLayoutMetricsHandler(UpdateLayoutMetricsDelegate impl);

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\"")
void SetVisualToMountChildrenIntoHandler(VisualToMountChildrenIntoDelegate impl);
};

Expand Down
9 changes: 9 additions & 0 deletions vnext/Microsoft.ReactNative/ViewProps.idl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ namespace Microsoft.ReactNative {
static void WriteValue(IJSValueWriter writer, Color color);
};

[experimental]
enum Overflow
{
Visible,
Hidden,
Scroll,
};

[webhosthidden]
[experimental]
DOC_STRING("Interface to implement custom view component properties.")
Expand All @@ -51,6 +59,7 @@ namespace Microsoft.ReactNative {
Color BackgroundColor { get; };
String TestId { get; };
String AccessibilityLabel { get; };
Overflow Overflow { get; };

// TODO add accessors to all the properties on ViewProps
};
Expand Down
Loading