diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp index d1991f70ba3..a917a2011ca 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp @@ -421,20 +421,23 @@ void FabricMountingManager::executeMount( // are updated in the view. This is necessary to ensure that events // (resulting from layout changes) are dispatched with the correct // padding information. - cppUpdatePaddingMountItems.push_back( - CppMountItem::UpdatePaddingMountItem( - mutation.newChildShadowView)); + if (newChildShadowView.layoutMetrics.contentInsets != + EdgeInsets::ZERO) { + cppUpdatePaddingMountItems.push_back( + CppMountItem::UpdatePaddingMountItem(newChildShadowView)); + } // Layout cppUpdateLayoutMountItems.push_back( - CppMountItem::UpdateLayoutMountItem( - mutation.newChildShadowView)); + CppMountItem::UpdateLayoutMountItem(newChildShadowView)); // OverflowInset: This is the values indicating boundaries including // children of the current view. The layout of current view may not // change, and we separate this part from layout mount items to not // pack too much data there. - if (useOverflowInset_) { + if (useOverflowInset_ && + newChildShadowView.layoutMetrics.overflowInset != + EdgeInsets::ZERO) { cppUpdateOverflowInsetMountItems.push_back( CppMountItem::UpdateOverflowInsetMountItem( newChildShadowView)); diff --git a/ReactCommon/react/renderer/graphics/RectangleEdges.h b/ReactCommon/react/renderer/graphics/RectangleEdges.h index 65f6f5990e3..2deae70b306 100644 --- a/ReactCommon/react/renderer/graphics/RectangleEdges.h +++ b/ReactCommon/react/renderer/graphics/RectangleEdges.h @@ -39,8 +39,13 @@ struct RectangleEdges { bool isUniform() const noexcept { return left == top && left == right && left == bottom; } + + static RectangleEdges const ZERO; }; +template +constexpr RectangleEdges const RectangleEdges::ZERO = {}; + template RectangleEdges operator+( RectangleEdges const &lhs,