Added property display: flex and none

Summary:
Fix #241 and successor for #302

Added new property ```display``` with ```YGDisplayFlex``` and ```YGDisplayNone```. Allows to hide nodes from the layout without the need to remove it from the DOM.
Closes https://github.com/facebook/yoga/pull/369

Reviewed By: astreet

Differential Revision: D4501141

Pulled By: emilsjolander

fbshipit-source-id: 0dfeee381f6d1e4bbba81926126b83dd7abab9d6
This commit is contained in:
Lukas Wöhrl
2017-02-06 09:31:22 -08:00
committed by Facebook Github Bot
parent c1cdc1de58
commit e567502750
27 changed files with 1529 additions and 6 deletions

View File

@@ -124,6 +124,11 @@ void Node::setOverflow(int overflow)
YGNodeStyleSetOverflow(m_node, static_cast<YGOverflow>(overflow));
}
void Node::setDisplay(int display)
{
YGNodeStyleSetDisplay(m_node, static_cast<YGDisplay>(display));
}
void Node::setFlex(double flex)
{
YGNodeStyleSetFlex(m_node, flex);
@@ -279,6 +284,11 @@ int Node::getOverflow(void) const
return YGNodeStyleGetOverflow(m_node);
}
int Node::getDisplay(void) const
{
return YGNodeStyleGetDisplay(m_node);
}
Value Node::getFlexBasis(void) const
{
return Value::fromYGValue(YGNodeStyleGetFlexBasis(m_node));

View File

@@ -67,6 +67,7 @@ class Node {
void setMarginPercent(int edge, double margin);
void setOverflow(int overflow);
void setDisplay(int display);
void setFlex(double flex);
void setFlexBasis(double flexBasis);
@@ -111,6 +112,7 @@ class Node {
Value getMargin(int edge) const;
int getOverflow(void) const;
int getDisplay(void) const;
Value getFlexBasis(void) const;
double getFlexGrow(void) const;

View File

@@ -26,6 +26,10 @@ module.exports = {
DIRECTION_LTR: 1,
DIRECTION_RTL: 2,
DISPLAY_COUNT: 2,
DISPLAY_FLEX: 0,
DISPLAY_NONE: 1,
EDGE_COUNT: 9,
EDGE_LEFT: 0,
EDGE_TOP: 1,

View File

@@ -67,6 +67,7 @@ NBIND_CLASS(Node)
method(setMarginPercent);
method(setOverflow);
method(setDisplay);
method(setFlex);
method(setFlexBasis);
@@ -125,6 +126,9 @@ NBIND_CLASS(Node)
method(getBorder);
method(getOverflow);
method(getDisplay);
method(getPadding);
method(insertChild);