BREAKING [react_native] Move to new C-based implementation of css-layout in RN Android

Summary:
Moves from CSSNodeDEPRECATED to CSSNode. This has shown to be a huge performance win for layout time within FB.

This is BREAKING because CSSNode contains bug fixes that were not migrated to CSSNodeDEPRECATED which may change the way your layout appears. The most common of these by far involves `flex: 1`.

Previously, developers had to put `flex: 1` in many places it didn't belong in order to work around a bug in css-layout. Now `flex: 1` is treated properly and, unfortunately, this means that your layout may no longer look correct. Specifically, you may see that your layout looks collapsed, or children don't render. The fix is to simply remove `flex: 1` from those containers.

Reviewed By: emilsjolander

Differential Revision: D3992787

fbshipit-source-id: 7a3a2a34a8941c0524e6ba3c5379e434d3e03247
This commit is contained in:
Andy Street
2016-11-21 06:16:27 -08:00
committed by Facebook Github Bot
parent 27817bed0e
commit d63ba47b59
16 changed files with 124 additions and 33 deletions

View File

@@ -19,8 +19,8 @@ import com.facebook.csslayout.CSSDirection;
import com.facebook.csslayout.CSSFlexDirection;
import com.facebook.csslayout.CSSJustify;
import com.facebook.csslayout.CSSLayoutContext;
import com.facebook.csslayout.CSSNode;
import com.facebook.csslayout.CSSNodeAPI;
import com.facebook.csslayout.CSSNodeDEPRECATED;
import com.facebook.csslayout.CSSOverflow;
import com.facebook.csslayout.CSSPositionType;
import com.facebook.csslayout.CSSWrap;
@@ -30,9 +30,9 @@ import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
/**
* Base node class for representing virtual tree of React nodes. Shadow nodes are used primarily
* for layouting therefore it extends {@link CSSNodeDEPRECATED} to allow that. They also help with handling
* Common base subclass of {@link CSSNodeDEPRECATED} for all layout nodes for react-based view. It extends
* {@link CSSNodeDEPRECATED} by adding additional capabilities.
* for layouting therefore it extends {@link CSSNode} to allow that. They also help with handling
* Common base subclass of {@link CSSNode} for all layout nodes for react-based view. It extends
* {@link CSSNode} by adding additional capabilities.
*
* Instances of this class receive property updates from JS via @{link UIManagerModule}. Subclasses
* may use {@link #updateShadowNode} to persist some of the updated fields in the node instance that
@@ -74,7 +74,7 @@ public class ReactShadowNode {
private float mAbsoluteBottom;
private final Spacing mDefaultPadding = new Spacing(0);
private final Spacing mPadding = new Spacing(CSSConstants.UNDEFINED);
private final CSSNodeDEPRECATED mCSSNode = new CSSNodeDEPRECATED();
private final CSSNode mCSSNode = new CSSNode();
/**
* Nodes that return {@code true} will be treated as "virtual" nodes. That is, nodes that are not