Added property display: flex and none #369
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature-hidden-nodes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fix #241 and successor for #302
Added new property
display
withYGDisplayFlex
andYGDisplayNone
. Allows to hide nodes from the layout without the need to remove it from the DOM.@joce does this solve it in a way that would work for you?
@woehrl01 could you add API bindings for java/csharp/objc/js?
I'll come back tomorrow and comment on the implementation. API looks good though. Thanks!
@emilsjolander I could give it a try, but I only have c++ set up at the moment (new laptop) so I have to rely on travis, will take me "some" time. Not sure about js/nbind, maybe @arcanis could do a follow up 😊 please?
@woehrl01 java/csharp/objc should be trivial as it is just a simple property setter, just follow what is done for overflow already. I could probably do the javascript stuff unless @arcanis has some time 👍
@emilsjolander "some" time 😉 I hope I haven't missed a file. I'll wait on the travis build.
I'm afraid I won't have time to work on this this week, but it shouldn't be much more than copying what is done for
setPositionType
- same prototype, same concept (cf https://github.com/facebook/yoga/blob/master/javascript/sources/Node.hh#L55, https://github.com/facebook/yoga/blob/master/javascript/sources/Node.cc#L67-L70 and https://github.com/facebook/yoga/blob/master/javascript/sources/nbind.cc#L55). One run ofenums.py
, another to generate the tests, and that should be it! ... should :)@arcanis thanks! That should be enough for me to do this. Don't worry about it
@emilsjolander @arcanis Thanks for the hint. I updated those files, too, let's see if those are enough 👍 😄
@woehrl01 You are a god among men. I can't thank you enough.
@joce I'm happy that it fits your needs!
Could you add a test to ensure that margin of a hidden node does not effect the next sibling?
@@ -0,0 +1,27 @@
<div id="display_none" style="width: 100px; height: 100px; flex-direction: row;">
All these tests are a bit more complicated than they need to be. For example this first test could be done with just 2 children and have the same effect.
@@ -0,0 +23,4 @@
<div id="display_none_with_position" style="width: 100px; height: 100px; flex-direction: row;">
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1; display:none; top: 10px;"></div>
what are you trying to test here?
@@ -310,6 +310,18 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue());
please use the generated fromInt() method on
YogaDisplay
. We should be doing the same in other places (i'll push a commit for that now, don't worry about it)@@ -310,6 +310,18 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue());
took the changes from GetOverflow and just renamed the name. If you push a commit I'll leave this for now.
@@ -0,0 +23,4 @@
<div id="display_none_with_position" style="width: 100px; height: 100px; flex-direction: row;">
<div style="flex-grow: 1;"></div>
<div style="flex-grow: 1; display:none; top: 10px;"></div>
If the position for hidden nodes is 0 or 10. It is 0, so we need to set the postion to 0 in
ZeroOutLayoutRecursivly
, not sure if this is actually a good idea, that's the reason I didn't implemented it yet. I'm curious what you think about that.@@ -0,0 +1,27 @@
<div id="display_none" style="width: 100px; height: 100px; flex-direction: row;">
True, I'll make them simpler/split them up.
Looks good! Thanks for this 👍 👍 👍 👍 👍
@emilsjolander has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Pull request closed