diff --git a/ReactCommon/yoga/yoga/YGLayout.cpp b/ReactCommon/yoga/yoga/YGLayout.cpp index 8f00c0f3e..66348fc29 100644 --- a/ReactCommon/yoga/yoga/YGLayout.cpp +++ b/ReactCommon/yoga/yoga/YGLayout.cpp @@ -26,14 +26,7 @@ YGLayout::YGLayout() nextCachedMeasurementsIndex(0), cachedMeasurements(), measuredDimensions(kYGDefaultDimensionValues), - cachedLayout({ - .availableWidth = 0, - .availableHeight = 0, - .widthMeasureMode = (YGMeasureMode)-1, - .heightMeasureMode = (YGMeasureMode)-1, - .computedWidth = -1, - .computedHeight = -1, - }), + cachedLayout(YGCachedMeasurement()), didUseLegacyFlag(false), doesLegacyStretchFlagAffectsLayout(false) {} diff --git a/ReactCommon/yoga/yoga/Yoga-internal.h b/ReactCommon/yoga/yoga/Yoga-internal.h index 43723df08..21b14b239 100644 --- a/ReactCommon/yoga/yoga/Yoga-internal.h +++ b/ReactCommon/yoga/yoga/Yoga-internal.h @@ -50,6 +50,14 @@ struct YGCachedMeasurement { float computedWidth; float computedHeight; + YGCachedMeasurement() + : availableWidth(0), + availableHeight(0), + widthMeasureMode((YGMeasureMode)-1), + heightMeasureMode((YGMeasureMode)-1), + computedWidth(-1), + computedHeight(-1) {} + bool operator==(YGCachedMeasurement measurement) const { bool isEqual = widthMeasureMode == measurement.widthMeasureMode && heightMeasureMode == measurement.heightMeasureMode;