diff --git a/src/main/java/com/facebook/components/ComponentsPools.java b/src/main/java/com/facebook/components/ComponentsPools.java index 836bd6f00e4..9e16e493d22 100644 --- a/src/main/java/com/facebook/components/ComponentsPools.java +++ b/src/main/java/com/facebook/components/ComponentsPools.java @@ -23,6 +23,7 @@ import com.facebook.components.config.ComponentsConfiguration; import com.facebook.components.displaylist.DisplayList; +import com.facebook.yoga.YogaConfig; import com.facebook.yoga.YogaDirection; import com.facebook.yoga.YogaExperimentalFeature; import com.facebook.yoga.YogaNode; @@ -41,6 +42,8 @@ */ public class ComponentsPools { + private static YogaConfig sYogaConfig; + private static final int SCRAP_ARRAY_INITIAL_SIZE = 4; private ComponentsPools() { @@ -175,13 +178,16 @@ static synchronized YogaNodeAPI acquireYogaNode() { } catch (UnsatisfiedLinkError ule) { // Fallback to yoga Node when ReNode is not availiable sShouldUseRelayout = false; - YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); node = new YogaNode(); } } else if (sShouldUseCSSNodeJNI) { - YogaNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); - node = new YogaNode(); + if (sYogaConfig == null) { + sYogaConfig = new YogaConfig(); + sYogaConfig.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); + } + + node = new YogaNode(sYogaConfig); } else { node = new CSSNodeDEPRECATED(); }