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
Summary:
Fix#326. I'll open another PR once this one gets accepted to add support for `YGLayoutGetBorder` 👌
Closes https://github.com/facebook/yoga/pull/335
Reviewed By: gkassabli
Differential Revision: D4409399
Pulled By: emilsjolander
fbshipit-source-id: 8153f6701cab60b55a485f6d2e0b9f7767481090
Summary:
Using shared code for reuse in other platforms based on iOS native implementation.
Adds YogaKit sample.
Adds YogaKit tests (same as objc).
```
YogaKitTest : 80 ms
Facebook.YogaKit.iOS.Tests.exe : 81 ms
Tests run: 11 Passed: 8 Inconclusive: 0 Failed: 3 Ignored: 1
```
Since we don't have extension properties we need to go with a extension method to get access to the YogaLayout .
I m also not sure this is leak free yet, would love some help with testing and feedback about view/node lifecycle
Closes https://github.com/facebook/yoga/pull/336
Reviewed By: splhack
Differential Revision: D4415027
Pulled By: emilsjolander
fbshipit-source-id: c88328212426c3200e6f0c48cda594cd2c432065
Summary:
Simple fix on a possible copy paste error. The test actually passes the same way by coincidence.
Closes https://github.com/facebook/yoga/pull/338
Reviewed By: dshahidehpour
Differential Revision: D4415019
Pulled By: emilsjolander
fbshipit-source-id: 823c3efc821db14b70d9dfe99ef87d1d7ebb75d0
Summary:
- Always launch buck build for Build, but copy native library when it was changed
- Rename Facebook.Yoga.Mac.Test to Facebook.Yoga.Mac.Sample
- Add Facebook.Yoga.Mac.Tests for NUnit test.
- "Run Unit Tests" menu item was activated for the target, but Mono still can't find libyoga.dylib
Closes https://github.com/facebook/yoga/pull/332
Reviewed By: emilsjolander
Differential Revision: D4408799
Pulled By: splhack
fbshipit-source-id: b3f5f9ebd8265cc152ca859176afbf54efa8f170
Summary: Need API needs some new docs. I also removed the repo's `.hgignore` and added everything to fbobjc `.hgignore` via `./Tools/generate_hgignore.py` which uses Yoga's `.gitignore`.
Reviewed By: emilsjolander
Differential Revision: D4403967
fbshipit-source-id: f2158e4feb27953d1d9e21c775926e6207220c4a
Summary:
Since there's a couple of changes after last month pr of #280 , here's a new pr for Xamarin support #276 , the idea is to add Xamarin iOS, Mac and Android support.
- Add Xamarin iOS support for Yoga, by providing a wrapper for the native lib.
- Add Xamarin iOS Unit testing project
~~- Adds a YogaKit shared implementation in c#.~~
~~- Adds a YogaKIt iOS implementation.~~
~~- Adds Yoga/YogaKit iOS sample application~~
Facebook.Yoga.iOS.Tests.exe : 169 ms
Tests run: 114 Passed: 114 Inconclusive: 0 Failed: 0 Ignored: 0

Closes https://github.com/facebook/yoga/pull/324
Reviewed By: emilsjolander
Differential Revision: D4401408
Pulled By: splhack
fbshipit-source-id: ecdae7967060361bef2bc25a5ef759cb9a957322
Summary: Allow aspect ratio to expand beyond bounds of parent as is generally accepted in css
Reviewed By: passy
Differential Revision: D4397547
fbshipit-source-id: d2b1ca7b096f2f17b3efbd8f47a50678bfe7bb5f