Left, Right, Top and Bottom with percentages don't work when same element has flexDirection: 'row' #454
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
Description
Here is example:
With this code the layout should look something like this:

Instead it looks like this:

So the
left
is not calculated right when the same element hasflexDirection: 'row'
This same happened also when using
left
,right
,bottom
andtop
properties.Reproduction
Run the code above by yourself. Also you can see how the same should look in the web: https://jsfiddle.net/L8ps52sp/3/
Solution
I think @emilsjolander should check this out since he added percentages in latest version ;)
Additional Information
@henrikra the first issue there is, is that you assume that yoga uses the same defaults for layouting as in the web. Sadly it's not. We are currently adding an option for using the defaults. If you apply the yoga-defaults to your jsfiddle, it certainly looks different from your expectation.
Nevertheless it looks like that there could be a bug somewhere, too.
@henrikra I extracted the following test case:
And this gets layouted from yoga as you expected. As you currently use react native 0.42 and we had some percentage fixes in this repo which aren't yet in 0.42 I'd suggest to checkout the master of react-native and look if this is reproducable there.
Hmm at the moment I don't know how to do that? It is possible if you try it? Or somebody else in yoga community?
Unfortunately I have no iOS/MacOS to test this, so somebody else needs to have a look.
Marking this as solved. Hopefully the next RN update will solve this for you @henrikra
Okay! I will reopen this if we still have problems after the update :D
I've tested this in RN version 0.44, and the problem still exists, updates?
@emilsjolander @woehrl01 Any news?
@henrikra Sorry no, as I can't reproduce in pure yoga. (still no IOS/RN user)
This actually works. It's not a bug. I wanted to test if the issue still exists but the code wasn't working, so I rewrote it ⸺