Skip to content

Commit

Permalink
Move configuration to new YGConfig and pass them down to CalculateLayout
Browse files Browse the repository at this point in the history
Summary:
Move configuration to new ```YGConfig``` and pass them down to CalculateLayout. See #418 .

Adds ```YGConfigNew()``` + ```YGConfigFree```, and changed ```YGSetExperimentalFeatureEnabled``` to use the config.

New function for calculation is ```YGNodeCalculateLayoutWithConfig```.
Closes facebook/yoga#432

Reviewed By: astreet

Differential Revision: D4611359

Pulled By: emilsjolander

fbshipit-source-id: a1332f0e1b21cec02129dd021ee57408449e10b0
  • Loading branch information
woehrl01 authored and facebook-github-bot committed Mar 1, 2017
1 parent d33721e commit a3692f8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/com/facebook/components/ComponentsPools.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -41,6 +42,8 @@
*/
public class ComponentsPools {

private static YogaConfig sYogaConfig;

private static final int SCRAP_ARRAY_INITIAL_SIZE = 4;

private ComponentsPools() {
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit a3692f8

Please sign in to comment.