1616#include < react/featureflags/ReactNativeFeatureFlags.h>
1717#include < react/jni/ReadableNativeMap.h>
1818#include < react/renderer/components/scrollview/ScrollViewProps.h>
19- #include < react/renderer/components/view/BaseViewProps.h>
2019#include < react/renderer/components/view/conversions.h>
2120#include < react/renderer/core/DynamicPropsUtilities.h>
2221#include < react/renderer/core/conversions.h>
@@ -65,9 +64,8 @@ void FabricMountingManager::setComputedBoxModelRegistry(
6564
6665namespace {
6766
68- inline bool hasClipPath (const ShadowView& shadowView) {
69- auto props = std::dynamic_pointer_cast<const BaseViewProps>(shadowView.props );
70- return props && props->clipPath .has_value ();
67+ inline bool needsComputedBoxModel (const ShadowView& shadowView) {
68+ return shadowView.traits .check (ShadowNodeTraits::Trait::NeedsComputedBoxModel);
7169}
7270
7371#ifdef REACT_NATIVE_DEBUG
@@ -718,14 +716,14 @@ void FabricMountingManager::executeMount(
718716 }
719717
720718 // Store BoxModel data (margin and padding) only if layout
721- // information has changed and clipPath prop is present. This
722- // information is needed for proper calculation of the clipPath
719+ // information has changed and NeedsComputedBoxModel trait is set.
720+ // This information is needed for proper calculation of the clipPath
723721 // geometry box.
724- auto oldHasClipPath = hasClipPath (oldChildShadowView);
725- auto newHasClipPath = hasClipPath (newChildShadowView);
722+ auto oldNeedsComputedBoxModel = needsComputedBoxModel (oldChildShadowView);
723+ auto newNeedsComputedBoxModel = needsComputedBoxModel (newChildShadowView);
726724
727725 if (computedBoxModelRegistry_) {
728- if (newHasClipPath &&
726+ if (newNeedsComputedBoxModel &&
729727 (oldChildShadowView.layoutMetrics .marginInsets !=
730728 newChildShadowView.layoutMetrics .marginInsets ||
731729 oldChildShadowView.layoutMetrics .paddingInsets !=
@@ -735,7 +733,7 @@ void FabricMountingManager::executeMount(
735733 newChildShadowView.tag ,
736734 newChildShadowView.layoutMetrics .marginInsets ,
737735 newChildShadowView.layoutMetrics .paddingInsets );
738- } else if (oldHasClipPath && !newHasClipPath ) {
736+ } else if (oldNeedsComputedBoxModel && !newNeedsComputedBoxModel ) {
739737 computedBoxModelRegistry_->remove (
740738 surfaceId, newChildShadowView.tag );
741739 }
@@ -828,7 +826,7 @@ void FabricMountingManager::executeMount(
828826 // information has changed and clipPath prop is present. This
829827 // information is needed for proper calculation of the clipPath
830828 // geometry box.
831- if (hasClipPath (newChildShadowView)) {
829+ if (needsComputedBoxModel (newChildShadowView)) {
832830 if (computedBoxModelRegistry_) {
833831 computedBoxModelRegistry_->store (
834832 surfaceId,
0 commit comments