Summary: There are still some pieces of RN which does not handle YGUnitAuto and makes use of either the value being nan or the unit being undefined. This diff makes this more robust to those kinds of situations.
Reviewed By: wwjholmes
Differential Revision: D4567045
fbshipit-source-id: ace5fd89bd534a6bb5ec7dba0c3afbf13d62d7c9
Summary: Travis builds are failing due to ANDROID_SDK not being set. So we set both it and ANDROID_HOME to where homebrew should have created a link to the installation.
Reviewed By: emilsjolander
Differential Revision: D4571703
fbshipit-source-id: a6dc4eb07006dc8baefb6ca938111ff256c6f018
Summary: Adds the Travis build badge for the android target to the README.md
Reviewed By: emilsjolander
Differential Revision: D4571693
fbshipit-source-id: a5110dac7d86989cc4a14b858c63d59332072869
Summary: The yoga splash screen that runs at the beginning of the app is unnecessary and can be removed for simplicty.
Reviewed By: emilsjolander
Differential Revision: D4571624
fbshipit-source-id: 3eb12f7c3447805f4546bd192df9670c5427572a
Summary:
I couldn't resist to do this 😄#394
This adds ```flex-wrap: wrap-reverse```
I think we hit a edge case here:
https://stackoverflow.com/questions/33891709/when-flexbox-items-wrap-in-column-mode-container-does-not-grow-its-width
as is differs here from chrome, but I think that yoga is here more correct.
So I haven't added this test yet as this would fail against chrome, as chrome outputs a width of 30 for root, whereas yoga gets a width of 60 here, which I think is correct. Strangely the output of ```flex-wrap:wrap``` is in jsfiddle also only with a (visual) width of 30 on chrome, while the tests gets generated with 60.
```html
<div id="wrap_reverse_column" style="height: 100px; flex-wrap: wrap-reverse">
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
</div>
```
Looking forward what you think here emilsjolander
Closes https://github.com/facebook/yoga/pull/398
Reviewed By: astreet
Differential Revision: D4564711
Pulled By: emilsjolander
fbshipit-source-id: 33dc055abd8444b2aa7796ef90bd7ec99e961bb8
Summary:
I don't even know how people have been running tests (unless they install BUCK). This creates a workspace to make it much easier to run tests.
Closes https://github.com/facebook/yoga/pull/400
Differential Revision: D4565290
Pulled By: dshahidehpour
fbshipit-source-id: 762168ced81e517126ac05c92bb27ccad0d9d305
Summary:
We still had the default one from the template.
Closes https://github.com/facebook/yoga/pull/403
Reviewed By: astreet
Differential Revision: D4564708
Pulled By: emilsjolander
fbshipit-source-id: ec76325e0dca34f89e5a920627ced7fa812827de
Summary:
...to reflect the modern world we live in with dynamic DPI platforms :)
Closes https://github.com/facebook/yoga/pull/375
Reviewed By: dshahidehpour
Differential Revision: D4528518
Pulled By: emilsjolander
fbshipit-source-id: e422bd4ae148e02c598a7b484a6adfa8c0e1e0c9
Summary:
Even so I know there are some opinions against ```margin: 0 auto``` it's still part of the spec: https://www.w3.org/TR/css-flexbox-1/#auto-margins and pretty usefull if you have to position via ```justify-content```.
This PR adds an implementation for that.
It adds an additonal ```YGUnitAuto``` and margins got ```YGNodeStyleSetMarginAuto``` functions as well.
Closes https://github.com/facebook/yoga/pull/357
Reviewed By: astreet
Differential Revision: D4501142
Pulled By: emilsjolander
fbshipit-source-id: 86519f8632496f46e78a7c9dbc5b21e212e3e0c7
Summary: This is an update of facebook/yoga#368 which was reverted. It fixes support for align-content: strech with multiple lines. The problem with the last attempt at solving this was that align-items:stretch was interfering. We handle this now by detecting when the flex basis of the children hints at them overflowing. This is not 100% correct as the size of the items could change when remeasuring but it will work in 99% of cases.
Reviewed By: astreet
Differential Revision: D4551234
fbshipit-source-id: 2964f19cf415991dc55dfa2caa4868cb00c56bd0
Summary: The sample app has library-like elements (i.e. the `YogaLayout` and associated files). This separates them out into a separate tree.
Reviewed By: emilsjolander
Differential Revision: D4558263
fbshipit-source-id: 33f8cec99661ef20e0e882663b554c12ae33c12f
Summary: Adds a simple "photo with poster and comment" layout to the landing page as an example for Android, along with the XML.
Reviewed By: emilsjolander
Differential Revision: D4558478
fbshipit-source-id: c7302321a67e99f5853358e711ff538d192f06e9
Summary: Resources don't usually live under the package name. We want to gradle build this soon, so making the directory structure as traditional as possible is best.
Reviewed By: emilsjolander
Differential Revision: D4557978
fbshipit-source-id: 7f80599201fe007a895e52bc5141425f9a83eb51
Summary: Adds docs for how to build the Android sample app and use the `YogaLayout`.
Reviewed By: emilsjolander
Differential Revision: D4557955
fbshipit-source-id: 49a3b8fde20de81a895244ffcecbd5bf392455b0
Summary: && instead of ; and only update xctools if needed
Reviewed By: passy
Differential Revision: D4558044
fbshipit-source-id: 90d55bf0147026e527b238365835d803a4bee7fb
Summary: The sample app is simply moved into the repo. A few libraries are included and the buck targets rearranged.
Reviewed By: emilsjolander
Differential Revision: D4528129
fbshipit-source-id: 3e9e779857cd9219711a939876c9275d75e09929
Summary:
I'm cleaning up these files in their own revision because I want to trigger
dirsync sandcastle separately from my other cleanup.
Reviewed By: mzlee
Differential Revision: D4549131
fbshipit-source-id: 1d45118256d8b517dea7a2b6c9e50bca1ccc1b0c
Summary: For some internal Instagram diffs, and some external ones (auto-detection of dirty nodes). We need to give the dirty properties a little love. This adds a getter to find out if your node is dirty, and makes sure that the leaf node is properly setup before it is marked dirty to prevent a crash.
Reviewed By: emilsjolander
Differential Revision: D4549241
fbshipit-source-id: 36eda6fdb4ea7f968d126aab6da67896f4a01d40
Summary:
Currently, our configuration of Views looks like this:
```objc
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
view.yoga.isEnabled = YES;
view.yoga.height = 50;
view.yoga.width = 50;
```
Every time that we access `view.yoga` we have to access the associated object on `UIView` to get the `YGLayout`. This adds an extra `objc_msgSend` which increases binary size, and is slight perf impact.
This diff creates a way to modify the `YGLayout` with only a single `objc_msgSend`. Here's the new syntax:
```objc
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
[view configureLayoutWithBlock:^void(YGLayout *layout){
layout.isEnabled = YES
layout.height = 50;
layout.width = 50;
}];
```
Here's the Swift version:
```swift
let view = UIView(frame: .zero)
view.configureLayout { (layout) in
layout.isEnabled = true
layout.height = 50
layout.width = 50
}
```
Closes https://github.com/facebook/yoga/pull/393
Reviewed By: emilsjolander
Differential Revision: D4550382
Pulled By: dshahidehpour
fbshipit-source-id: 76d797d1e0de8e5dc767e02180a7fc440a70212e
Summary:
To date, our sample project was lacking. There is still a lot of work that can be done to improve, but, this is a step in the right direction.
Here are the changes in this commit:
1. The project is written in Swift.
2. Created new CollectionView (via [IGListKit](https://github.com/instagram/iglistkit)), making it very easy to add new examples.
3. New examples for basic layouts, and including/excluding layouts on the fly.
Here's a video!

Closes https://github.com/facebook/yoga/pull/392
Reviewed By: emilsjolander
Differential Revision: D4550379
Pulled By: dshahidehpour
fbshipit-source-id: 64a07acf96c1887f1d2ad0c54971fcedb64334a0
Summary: Split travis into one run per language. This should improve build speed as well as improve signal as to what is failing.
Reviewed By: dshahidehpour
Differential Revision: D4551194
fbshipit-source-id: 36bc60193b4b287352073ab62a7bd053b15eaedf
Summary: While debugging something at Instagram, I kept seeing a UILabel be truncated when it clearly had enough room to display all its' text. What I realized is that during our pixel rounding, we were losing precision because we were using the incorrect rounding function for floats. Changing from `round()` (which is for doubles) to `roundf()` fixed it.
Reviewed By: amonshiz
Differential Revision: D4549069
fbshipit-source-id: 78a1bb33e315e7c066b7fb625b1f5a28def76515
Summary:
Fixes ```align-content:strech``` on nodes without specified cross dimension, if there are multiple lines. Currently it uses the full height of the parent, but it has to use the line height. As we don't know the number of lines until here, we need to realign the relevant children.
Closes https://github.com/facebook/yoga/pull/368
Reviewed By: gkassabli
Differential Revision: D4528559
Pulled By: emilsjolander
fbshipit-source-id: 019e6f85fa452d0c3412f711e3886f0c4452da47
Summary:
Due to the changes in 46817a38. We have a bug if the layout changes.
This PR fixes this bug and adds a test for it.
Additionally it correctly marks negative percentage values as undefined dim.
It also changes the ```resolvedDimensions``` to use a reference instead of the full value in order to minimize the memory requirement of a ```YGNode``` and reduces the copying of the ```YGValue```.
Closes https://github.com/facebook/yoga/pull/379
Reviewed By: gkassabli
Differential Revision: D4528552
Pulled By: emilsjolander
fbshipit-source-id: c024fe3a009c3788af319b689858ea3374c46477
Summary:
Adds the two missing alignments ```space-between``` and ```space-around``` for ```align-content``` . Those values are a noop on ```align-items``` in order to prevent a breaking changes for an additional enum.
Fix#229
Closes https://github.com/facebook/yoga/pull/364
Reviewed By: gkassabli
Differential Revision: D4528561
Pulled By: emilsjolander
fbshipit-source-id: ea6291b6dd22cef05d9eec03893250d50371236e
Summary:
This PR changes the enums.py to create the header the same as format.sh would layout it. Reduces the clutter due to missed format.sh calls after enums.py generation.
Closes https://github.com/facebook/yoga/pull/380
Reviewed By: gkassabli
Differential Revision: D4529593
Pulled By: emilsjolander
fbshipit-source-id: 7281e0d500f79459c19cc8fe6dbc8fd77f0a537c
Summary:
Now that the Yoga library supports percentage values, the results returned from it's API were changed.
`YGNodeStyleGetPadding` returns the explicit value that you set, whereas `YGNodeLayoutGetPadding` returns the computed value. Since we are planning to build support for percentages, I'm modifying our API so that it strictly returns the value that was set. As a result:
```
view.yoga.margin = 10;
// view.yoga.margin == 10
// view.yoga.marginLeftWidth == 0
// view.yoga.marginRightWidth == 0
// etc.
```
Reviewed By: emilsjolander
Differential Revision: D4543471
fbshipit-source-id: a731025cd4b47e9f1a559c766494fc5a259291ae
Summary: Handles nans. Also if the unit is undefined there is no need to check the value.
Reviewed By: astreet
Differential Revision: D4531805
fbshipit-source-id: 723e15381e9fa39837a4c99f726501eda26af11b
Summary: This reflects a check to native code where style values will always return the value that was set on them and default to undefined.
Reviewed By: astreet
Differential Revision: D4531779
fbshipit-source-id: 97a789e70dcf0fb5174e2039991e7a2b27f45f01
Summary:
Two bugs:
1. Min/Max width/height should have higher priority than width/height
2. custom measure nodes percentages should be based in parent size like everything else.
Differential Revision: D4537576
fbshipit-source-id: c003f723f424afbca63170d41e54fd5ff837926d
Summary: Currently, we have an issue in YogaKit where it ignores the preexisting bounds a root view. There are multiple fixes for this, but the easiest one for developer experience is to apply the preexisting bounds of the root view to it's frame after layout calculation.
Reviewed By: emilsjolander
Differential Revision: D4537173
fbshipit-source-id: ccef8b1c1398ea299b4e5710abe597378347a48d
Summary: If a node has minDimension and maxDimension set at the same value, yoga will treat it as having a set dimension, doing less calculations.
Reviewed By: emilsjolander
Differential Revision: D4492395
fbshipit-source-id: 3f4293548399e006aa808b9586d24e77c7df1f21