diff --git a/packages/react-native/ReactCommon/yoga/yoga/style/Style.h b/packages/react-native/ReactCommon/yoga/yoga/style/Style.h index 37c0ba2a9a8..a06bd246b45 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/style/Style.h +++ b/packages/react-native/ReactCommon/yoga/yoga/style/Style.h @@ -661,10 +661,10 @@ class YG_EXPORT Style { lengthsEqual(padding_, pool_, other.padding_, other.pool_) && lengthsEqual(border_, pool_, other.border_, other.pool_) && lengthsEqual(gap_, pool_, other.gap_, other.pool_) && - lengthsEqual(dimensions_, pool_, other.dimensions_, other.pool_) && - lengthsEqual( + sizeLengthsEqual(dimensions_, pool_, other.dimensions_, other.pool_) && + sizeLengthsEqual( minDimensions_, pool_, other.minDimensions_, other.pool_) && - lengthsEqual( + sizeLengthsEqual( maxDimensions_, pool_, other.maxDimensions_, other.pool_) && numbersEqual(aspectRatio_, pool_, other.aspectRatio_, other.pool_) && gridTemplateColumns_ == other.gridTemplateColumns_ && @@ -716,6 +716,31 @@ class YG_EXPORT Style { }); } + static inline bool sizeLengthsEqual( + const StyleValueHandle& lhsHandle, + const StyleValuePool& lhsPool, + const StyleValueHandle& rhsHandle, + const StyleValuePool& rhsPool) { + return (lhsHandle.isUndefined() && rhsHandle.isUndefined()) || + (lhsPool.getSize(lhsHandle) == rhsPool.getSize(rhsHandle)); + } + + template + static inline bool sizeLengthsEqual( + const std::array& lhs, + const StyleValuePool& lhsPool, + const std::array& rhs, + const StyleValuePool& rhsPool) { + return std::equal( + lhs.begin(), + lhs.end(), + rhs.begin(), + rhs.end(), + [&](const auto& lhs, const auto& rhs) { + return sizeLengthsEqual(lhs, lhsPool, rhs, rhsPool); + }); + } + StyleValueHandle computeColumnGap() const { if (gap_[yoga::to_underlying(Gutter::Column)].isDefined()) { return gap_[yoga::to_underlying(Gutter::Column)];