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
Summary: Test fails when we have flexible child and min/max layout dimension. Yoga should flex the child to minimal size, while in reality Yoga flexes it to maximal size
Reviewed By: emilsjolander
Differential Revision: D4456312
fbshipit-source-id: 82a39bc93cf3bf2374b968e9f7403397e752908e
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
Summary:
I incorrectly sized some assets, as a result, the sample project had some warnings about it when you built. This fixes it.
Closes https://github.com/facebook/yoga/pull/377
Differential Revision: D4515193
Pulled By: dshahidehpour
fbshipit-source-id: 3af6e79a17777bec3798bbf7294af5716f65e37a
Summary: The Sample app needed some love. It wouldn't build because of some import errors, adding files is very manual, and it looked bad. I have fixed all of these things.
Reviewed By: amonshiz
Differential Revision: D4508624
fbshipit-source-id: bda40defb167ef871d8d0d5bb853d8905b9682d8
Summary: For percentage paddings/margins/sizes to work on the root node we need to have the ability to pass down the parent sizes. This has always been possible with the C API but was never exposed to java. This diff exposes this functionality.
Reviewed By: astreet
Differential Revision: D4501016
fbshipit-source-id: 0c9502e86ff200c021c78afb7ac4b48cf11b3bdb
Summary: Previously we needed to be able to return a computed value from the style edge getters to correctly handle things like RTL in frameworks such as React Native. However we now have a more correct solution with is to expose layout outputs for these edge values. This means we can go back to returning the raw value set for padding/margin/border like we do with other styles.
Reviewed By: astreet
Differential Revision: D4500892
fbshipit-source-id: e7c26bdda9ecbfc76b6cf1f384f8cf9f38284120
Summary: For our YogaKit sample project we want to add Cocoapods support and reference the local podspec. Unfortunately, this won't work unless the podspec lives in the root directory.
Reviewed By: emilsjolander
Differential Revision: D4507887
fbshipit-source-id: 919a8c8506768c90e50b3ae27deb51394db021e6
Summary: If parent size was undefined and node specified percentage size it would pass does an exact measure mode with an undefined value which broke an assertion.
Reviewed By: gkassabli
Differential Revision: D4494265
fbshipit-source-id: 9efef9e39a1b66af2d0f144575a96c919d60dbf7
Summary: Ensure that a percentage size is only "defined" if the parent size is defined.
Reviewed By: gkassabli
Differential Revision: D4494258
fbshipit-source-id: 36c31444cbd113a820b067fe9e7b9560ae1d4df7
Summary:
This PR forces the order of the generated enums in alphabetically order. This is needed to have a predictable order of the enums across different python versions. Which reduces the pain for merging multiple enum additions.
Closes https://github.com/facebook/yoga/pull/370
Reviewed By: gkassabli
Differential Revision: D4501140
Pulled By: emilsjolander
fbshipit-source-id: 66c0ed9e4ea7a5990578b53b0a7e400c13dd53a9
Summary: values() create a shallow copy of the underlying array every time as there are no immutable arrays in java. By using fromInt() we avoid this allocation.
Reviewed By: pasqualeanatriello
Differential Revision: D4494371
fbshipit-source-id: 11cff65114803e185bc67a96da0bf2a2c4a3e6d9
Summary: Ensure that `format.sh` can be run from anywhere with the same results.
Reviewed By: emilsjolander
Differential Revision: D4494367
fbshipit-source-id: cbd2cc36476a0a54a77a732cbe1b79388f7e0c46
Summary:
The format.sh was referring to an outdated `benchmarks/` directory and left out
a bunch of other C/C++ files. This updates it to cover all but the build
artifacts and vendored libraries in `lib/`.
Reviewed By: emilsjolander
Differential Revision: D4481490
fbshipit-source-id: 056e00359f794d0aa999fd65ec1ef0c657738867
Summary:
Hey there, congrats on the launch - we use React Native at Artsy, and I've been wondering about what Yoga + Jest Snapshots for RN looks like but haven't had the time to explore that yet.
With https://github.com/CocoaPods/cocoadocs.org/pull/501 I added the ability to customize the location of the README for the front-page of the CocoaPods site. That is being deployed as I speak, so it should be available the next time you decide to ship a version of Yoga.
I also fixed the capitalisation of CocoaPods, and removed a redundant CocoaPods badge on your initial README.
Closes https://github.com/facebook/yoga/pull/366
Reviewed By: emilsjolander
Differential Revision: D4488011
Pulled By: dshahidehpour
fbshipit-source-id: 6c0c4efc23a69e1fcb936214b159b49217218b49
Summary: Make the two podspecs more consistent with each other.
Reviewed By: dshahidehpour
Differential Revision: D4481945
fbshipit-source-id: ab782abecd709c763b4e931b6839a5cae6346281
Summary: When people file issues, they are (in-general) missing a lot of useful information. This template will now be included when people file issues. More info here: https://github.com/blog/2111-issue-and-pull-request-templates
Reviewed By: emilsjolander
Differential Revision: D4481713
fbshipit-source-id: 8c173e282438d5156d50fe40c581e18730d6a5af
Summary: Without specifying the deployment target, it was default to iOS 4.3. This would cause a build error because we are `unable to synthesize weak properties` which didn't come around until iOS 5. Setting default target to iOS 8.
Reviewed By: emilsjolander
Differential Revision: D4481772
fbshipit-source-id: d3be88d0f73533c6242fc1d9045c70ad4628fd21
Summary:
Being a environment test, `npm run is-monolithic` is expected to fail when pulling the package from npm and to succeed when pulling it from github. Unfortunately, when returning false, npm will throw a tantrum by default if not explicitely disabled. It's not a hard failure, the build still complete, but it's better this way.
Closes https://github.com/facebook/yoga/pull/362
Reviewed By: gkassabli
Differential Revision: D4480608
Pulled By: emilsjolander
fbshipit-source-id: 0832a2158647f49b5230e2f658997f94774cec5b
Summary:
Adds a Xamarin Android support for Yoga and respective tests. Closes#276 with this PR all Xamarin platforms will be covered
Need to figure a better strategy for the build names for buck with splhack .
It's failing 3 tests related with YogaNode and the GC :) classic!

```
Facebook.Yoga.Android.Tests.dll : 660.87 ms
: 678.788 ms
Tests run: 130, Passed: 127, Failed: 3, Skipped: 0, Inconclusive: 0
```
Closes https://github.com/facebook/yoga/pull/340
Reviewed By: emilsjolander
Differential Revision: D4475370
Pulled By: splhack
fbshipit-source-id: f050f10415e68e9808f629b843682b0f87cca065
Summary:
This supersedes #309 and #305.
This is still a **work-in-progress.**
**TODO**
- [x] Create Xcode project that builds an iOS framework
- [x] Fix failing tests on Xcode
- [ ] Make `pod lib lint` pass and make sure YogaKit can be included using CocoaPods
- [ ] Add `pod lib lint` to .travis.yml
- [x] Migrate to travis osx image with Xcode 8.2
**FOLLOW-UP**
- [ ] Make YogaKitSample use framework built by new Xcode project.
- [ ] Make Travis to upload prebuilt versions of the framework. More [here](https://github.com/Carthage/Carthage#use-travis-ci-to-upload-your-tagged-prebuild-frameworks)
- [ ] Upgrade github/jekyll docs about installation using Cocoapods/Carthage
Closes https://github.com/facebook/yoga/pull/352
Reviewed By: emilsjolander
Differential Revision: D4471950
Pulled By: dshahidehpour
fbshipit-source-id: 8f30c69f9a487b26aa2e5f3b66841334b01b0ab1
Summary: aspect ratio did not account for the widths and heights being including padding. This diff fixes that.
Reviewed By: astreet
Differential Revision: D4473024
fbshipit-source-id: 5a747e2f267b077203bb3b63e4c152847dc30774
Summary: run format & gentest scripts. Some of the javascript tests had not been generated recently by the looks of it.
Reviewed By: dshahidehpour
Differential Revision: D4459455
fbshipit-source-id: fc1eca58fe897c8f4a2571638b4f7035d023b479
Summary: This is the first step to adding cocoapods support to YogaKit. We are going to publish a `Yoga` framework to the store that we can use as a dependency. This will also allow developers to build their own abstractions easily using the core API.
Reviewed By: nlutsenko, emilsjolander
Differential Revision: D4466788
fbshipit-source-id: 8f08bdbf524e57c88f7fc3400c4ba6ad58f98d7f
Summary: Absolute children should not be constraint to the size of their parent if the parent does not have a size as this was causes the layout of the child to be skipped.
Reviewed By: gkassabli
Differential Revision: D4453612
fbshipit-source-id: e8269521560d2f42b2d6f0f0ff264a1605a57d79
Summary: We are saving the class reference in a static variable to should be using findClassStatic to ensure the reference is always valid.
Reviewed By: mhorowitz
Differential Revision: D4420352
fbshipit-source-id: 8c66c1b2213fe295334a9bdc4e1dd7e1a4285aae
Summary:
I did some stylistic changes to the Objective-C unit tests for the following reasons:
- When an equality assert fails, the error messages reads as if the value we are testing is the first argument and the value we expect is the second argument. To improve the readability of test messages, I made sure all `XCTAssertEqual` and `XCTAssertNotEqual` have the arguments in the correct order.
- Because failing equality asserts already comes with a detailed message including the value tested and the expected value, I rewrote several truth asserts on `CGSizeEqual` to two equality asserts on the width and height: when those fail, the error message are clearer.
Closes https://github.com/facebook/yoga/pull/351
Reviewed By: emilsjolander
Differential Revision: D4454484
Pulled By: dshahidehpour
fbshipit-source-id: 0c1295a4a7e8477eacfb3f4ef6648984fd102a51
Summary: Currently, some YogaKit tests fail when they are run in Xcode, but pass in BUCK. This cleans up the tests so that they more definitively test what they say they are testing, and the results are not affected by the enviroment they are run in.
Reviewed By: emilsjolander
Differential Revision: D4453745
fbshipit-source-id: 238e41960afe63d31e9f6efdcd947cfac39f2dc4
Summary:
Doing this externally to trigger a Travis build. This will put our Travis infra on the newest Xcode.
Closes https://github.com/facebook/yoga/pull/353
Reviewed By: emilsjolander
Differential Revision: D4453795
Pulled By: dshahidehpour
fbshipit-source-id: 23416405fdd43486c934bea0b720c217fafd7f30
Summary:
I'm trying to fix some bugs I introduced in my latest PR, but while writing the Unit Tests for them, I saw a really weird behaviour. The following exact piece of code WORKS inside a Yoga C++ unit test, but fails from a Objective-C unit test. I had me completely confused and blocked me in my progression. Any ideas?
```
TEST(YogaTest, stupid_test) {
const YGNodeRef node = YGNodeNew();
YGNodeStyleSetPosition(node, YGEdgeLeft, 1);
ASSERT_FLOAT_EQ(1, YGNodeStyleGetPosition(node, YGEdgeLeft).value);
ASSERT_EQ(YGUnitPixel, YGNodeStyleGetPosition(node, YGEdgeLeft).unit);
YGNodeFree(node);
}
```
```
- (void)testPositionalPropertiesWork
{
YGNodeRef node = YGNodeNew();
YGNodeStyleSetPosition(node, YGEdgeLeft, 1);
XCTAssertEqual(1, YGNodeStyleGetPosition(node, YGEdgeLeft).value);
XCTAssertEqual(YGUnitPixel, YGNodeStyleGetPosition(node, YGEdgeLeft).unit);
YGNodeFree(node);
}
```
Closes https://github.com/facebook/yoga/pull/328
Reviewed By: dshahidehpour
Differential Revision: D4421504
Pulled By: emilsjolander
fbshipit-source-id: f59379edf70aee87a77cd1ad2986313cdfe71b94
Summary:
Fixes issue brought up in https://github.com/facebook/react-native/issues/10603
The gist of the problem is that in css it is fine for a child to overflow a parent if it feels the need to, we were not respecting this.
Reviewed By: mmmulani
Differential Revision: D4182141
fbshipit-source-id: c73fd15d2577ab846fc8a202d529d0e6e1207b75
Summary:
Benchmarks are not located in folder benchmark. So rename folder
and buck target from 'benchmarks' to 'benchmark'.
Closes https://github.com/facebook/yoga/pull/339
Reviewed By: gkassabli
Differential Revision: D4420355
Pulled By: emilsjolander
fbshipit-source-id: 7a1bc6ece7f4b64c7cac506357e265c1b4790a4f