Summary: Trivial. Those lines were lost during rebasing of the original commit.
Reviewed By: priteshrnandgaonkar
Differential Revision: D6717696
fbshipit-source-id: a5dce25427c8977352b3ae7ea01e546a540e0c13
Summary:
Fix for android github CI.
Github CI doesn't work without this change.
CI passes.
[INTERNAL] Android CI fix.
Closes https://github.com/facebook/react-native/pull/17551
Differential Revision: D6707477
Pulled By: hramos
fbshipit-source-id: f98515234da3b90ee3233523bcd7cc67ed82c1b4
Summary:
Currently, we can dirty leaf nodes with `measure` function, we also can get `dirty` status for any node, but we cannot handle a moment when this change happen. This diff introduces a new call-back-manner handler for it.
We need this to plug Yoga inside and outside other layout systems without maintaining own dirty propagation infrastructure.
Consider using Yoga for flex-box layout in React Native where we can have deeply nested layout like `<View><Text><View><Text/></View></Text></View>` where all content of all <Text> nodes are laid out using native text/inline (not flex-box!) layout system. In this case, when some change dirties some deeply nested Yoga node, we have to propagate the dirty state down to outer one. Having this handler makes possible to wire up `on-dirty` handler on the root node and `setDirtied` for the leaf node.
Removing custom dirting mechanism from React Native should drastically simplify rendering layer and bring a huge performance win.
Reviewed By: emilsjolander
Differential Revision: D6597856
fbshipit-source-id: 6588cd712f9c1dede4af32f3d326f90103e48ff0
Summary:
Fix min/max percentage constraints on measured nodes. Currently we passed in the available size instead of the parent size.
Fixes#611
Closes https://github.com/facebook/yoga/pull/649
Reviewed By: priteshrnandgaonkar
Differential Revision: D6408019
Pulled By: emilsjolander
fbshipit-source-id: 18be5056dbc0dc179970ec231ab8b4e2cdba65c5
Summary:
Suppresses the unused warnings on ```YGDefaultLog```. It uses a more generic macro which simply casts the variable to ```(void)```. This is the simples approach to make mutiple different compilers happy. Fixes#650
Closes https://github.com/facebook/yoga/pull/651
Differential Revision: D6407999
Pulled By: emilsjolander
fbshipit-source-id: 19fd78dd8b84eafdbb48875dd003d506a98c4807
Summary:
If you have a measurable node and set ```marign-left: auto``` + ```align-item:stretch``` on it, it won't get measured and they get a width/height of ```-(nan)```. This change fixes that behaviour. Fixes#644.
Closes https://github.com/facebook/yoga/pull/645
Differential Revision: D6413512
Pulled By: emilsjolander
fbshipit-source-id: 755febeb33bb0d4520ca6b3c28d56ac333e4a14d
Summary:
Adds new ```space-evenly``` for ```justify-content```.
Also adds a typofix in one of the other justify-content tests.
Fixes#657
Closes https://github.com/facebook/yoga/pull/658
Differential Revision: D6407996
Pulled By: emilsjolander
fbshipit-source-id: cc837409e1345624b4bd72c31e25fe68dcb0f6a3
Summary:
This fixes shrinking of elements which are in a non stretch alignment, but keeps the legacy stretch behaviour in place. Additionally this adds a testcase for ```useLegacyStretchBehaviour```
Fixes#633
Closes https://github.com/facebook/yoga/pull/635
Differential Revision: D6408037
Pulled By: emilsjolander
fbshipit-source-id: 377ab0308dd3a75a148a0af31ab5eb3ffb5b5d83
Summary:
If we have a values already set to undefined and set it to undefined again, we invalidate the layout. This change takes this case into account and keeps the layout valid.
Fixes#630
Closes https://github.com/facebook/yoga/pull/648
Differential Revision: D6408013
Pulled By: emilsjolander
fbshipit-source-id: dc2a848d84d3de9f4650fac9e41d7c8169446406
Summary:
Expected to be able to call `YGNodeLayoutGetMargin(node, YGEdgeEnd)`, but instead, the program aborts with `"Cannot get layout properties of multi-edge shorthands"`.
This bug seems to incorrectly prevent properties from YGEdgeEnd for all Layout properties.
Closes https://github.com/facebook/yoga/pull/632
Differential Revision: D6408060
Pulled By: emilsjolander
fbshipit-source-id: 4ab3b2ffb2f1bb6fd3a27f780caf0123abcdb230
Summary:
The min/max inner width shouldn't take the margins into account.
Adds a test for both cases.
Fixes#664
Closes https://github.com/facebook/yoga/pull/665
Differential Revision: D6407982
Pulled By: emilsjolander
fbshipit-source-id: ffa549a06f802263e3b8488e90756aa3f722d52d
Summary:
This is meant to show a possible route format for a persistent form of Yoga. Where previous layouts can remain intact while still taking advantage of incremental layout by reusing previous subtrees.
```c
YGNodeRef YGNodeClone(const YGNodeRef node);
```
The core of this functionality is a new API to clone an existing node. This makes a new detached node with all the same values as the previous one. Conceptually this makes the original node "frozen" from that point on. It's now immutable. (This is not yet enforced at runtime in this PR but something we should add.)
Since the original is frozen, we reuse the children set from the original node. Their parent pointers still point back to the original tree though.
The cloned node is still mutable. It can have its styles updated, and nodes can be inserted or deleted. If an insertion/deletion happens on a cloned node whose children were reused, it'll first shallow clone its children automatically.
As a convenience I also added an API to clear all children:
```c
void YGNodeRemoveAllChildren(const YGNodeRef node);
```
During insert/delete, or as a result of layout a set of reused children may need to be first cloned. A kind of copy-on-write. When that happens, the host may want to respond. E.g. by updating the `context` such as by cloning any wrapper objects and attaching them to the new node.
```c
typedef void (*YGNodeClonedFunc)(YGNodeRef oldNode,
YGNodeRef newNode,
YGNodeRef parent,
int childIndex);
void YGConfigSetNodeClonedFunc(YGConfigRef config,
YGNodeClonedFunc callback);
```
This PR doesn't change any existing semantics for trees that are not first cloned.
It's possible for a single node to exist in two trees at once and be used by multiple threads. Therefore it's not safe to recursively free a whole tree when you use persistence. To solve this, any user of the library has to manually manage ref counting or tracing GC. E.g. by replicating the tree structure in a wrapper.
In a follow up we could consider moving ref counting into Yoga.
Closes https://github.com/facebook/yoga/pull/636
Reviewed By: emilsjolander
Differential Revision: D5941921
Pulled By: sebmarkbage
fbshipit-source-id: c8e93421824c112d09c4773bed4e3141b6491ccf
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.
You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html
Happy contributing!
-->
Cxx module code swallows c++ exception details with sarcastic comment let native developer figure it out.
Now instead of swallowing it, we print as much information as we can for different exception types.
Still not ideal but way more informative.
Have a crash in your c++ module and try to figure it out without this change.
Closes https://github.com/facebook/react-native/pull/16193
Differential Revision: D6040038
Pulled By: javache
fbshipit-source-id: 3fbe838383ca13395e21f74c9549474f6329cfeb
Summary:
This fixes shrinking of elements which are in a non stretch alignment
Fixes#633
Closes https://github.com/facebook/yoga/pull/634
Differential Revision: D5874862
Pulled By: emilsjolander
fbshipit-source-id: 1426aa6b60f6ba42c2be702e6f24cea935ab7acb
Summary:
**Breaking Change Notes**
To adapt to the breaking change, app developers that are consuming React Native through CocoaPods must update their Podfile to refer to yoga with a lowercase "y". In other words:
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
Must be changed to (note the lowercase "y"):
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
**Symptom**
If you consume React Native as a CocoaPod and consume a third-party React Native module not as a CocoaPod, you will receive a `nonportable-include-path` warning in Xcode >= 8.3.
**Details**
Xcode 8.3 introduced -Wnonportable-include-path which triggers if you import a header using different casing than the path to the header on disk. This triggers when consuming React Native as a CocoaPod from a library that isn't a CocoaPod. React Native imports Yoga using paths like this:
#import <yoga/Yoga.h>
Which means Yoga's headers are expected to be located in a directory called "yoga" with a lowercase "y". However, when React Native is a CocoaPod the Yoga headers for non-CocoaPods end up in the directory "$(BUILT_PRODUCTS_DIR)/Yoga".
To fix this such that Yoga's headers end up in "$(BUILT_PRODUCTS_DIR)/yoga" (note the lowercase "y"), I've changed Yoga's podspec name to have a lowercase "y".
**Test Plan**
Created a test app where React Native is consumed as a CocoaPod. Added the react-native-maps library to the project and configured it to not be consumed through CocoaPods. Verified that the app compiles properly without the `nonportable-include-path` warnings.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/15527
Differential Revision: D5706338
Pulled By: javache
fbshipit-source-id: 090daa2c3ebb1c66bd467e78a1e91791dbb06651
Summary:
This PR fixes a declaration mismatch for `YGNodeCanUseCachedMeasurement` where the last argument is declared non `const` in `.h` and `const` in `.c`.
Additionally it uses explicit `float` for fraction calculation do avoid usage of `double` assignment.
Closes https://github.com/facebook/yoga/pull/607
Differential Revision: D5677931
Pulled By: emilsjolander
fbshipit-source-id: 502da957089e4439ed956987ff8dec10bd033ba3
Summary:
== Before ==
- Aspect ratio would do its best to fit within it's parent constraints
- Aspect ratio would prioritize `alignItems: stretch` over other sizing properties.
== After ==
- Aspect ratio is allowed to make a node grow past its parent constraints. This matches many other aspects of flexbox where parent constraints are not treated as hard constraints but rather as suggestions.
- Aspect ratio only takes `alignItems: stretch` into account if no other size definition is defined. This matches the interaction of other properties with `alignItems: stretch`.
== Updating your code ==
**You probably don't need to do anything** but in case something does break in your product it should be as easy as adding `{width: '100%', height: '100%', flexShrink: 1}` to the style declaring the `aspectRatio`.
Reviewed By: gkassabli
Differential Revision: D5639187
fbshipit-source-id: 603e8fcc3373f0b7f2461da2dad1625ab59dcb19
Summary:
This fixes the case where we change the layout, so that it doesn't overflow anymore.
This also improves the readability by using `|=` instead of referencing the value twice.
Closes https://github.com/facebook/yoga/pull/587
Differential Revision: D5388657
Pulled By: emilsjolander
fbshipit-source-id: ce1b1ded1feed7314a2c16bf695f62b866c19ea0
Summary:
If we have a fractional measure output which matches the subpixel rounding factor, we still should round both dimension into the same direction.
Fixesfacebook/yoga#580.
Closes https://github.com/facebook/yoga/pull/583
Reviewed By: marco-cova
Differential Revision: D5274212
Pulled By: emilsjolander
fbshipit-source-id: 1febf9194210437ab77f91319d10d4da9b284b79
Summary:
* Cleanup some header files so we use more forward declarations
* Rename Executor to JSExecutor.h
* Move some typedefs to more appropriate locations
Reviewed By: mhorowitz
Differential Revision: D5301913
fbshipit-source-id: e75154797eb3f531d2f42a5e95409f4062b85f91
Summary:
The only thing I found in the spec for this change is the following. Not exactly sure if this is the thing this PR is about:
> For each flex item, subtract its outer flex base size from its max-content contribution size. If that result is not zero, divide it by (if the result was positive) its **flex grow factor floored at 1** or (if the result was negative) by its scaled flex shrink factor, having **floored the flex shrink factor at 1**. This is the item’s max-content flex fraction.
But at least it seems a required change.
Fixesfacebook/yoga#566
Closes https://github.com/facebook/yoga/pull/572
Differential Revision: D5264388
Pulled By: emilsjolander
fbshipit-source-id: 0004d1c3b9bad070a98cd6766c1adc06a54475f8
Summary: Looks like `CxxModule::Method` already supports 0..2 callbacks. Based on Obj-C implementation (RCTModuleMethod.m:492) and JS bridge code (NativeModules.js:76), 2 callbacks native method is transformed to JS promise by JS part of the bridge.
Reviewed By: javache
Differential Revision: D5207852
fbshipit-source-id: 5aad86d45b97397f2bc3a4dbc648a60d96a4689e
Summary:
This is a fix on top of 56b10fc. It takes the case into account were you have `wrap-reverse` and `align-items: flex-end` set.
Closes https://github.com/facebook/yoga/pull/568
Differential Revision: D5155521
Pulled By: emilsjolander
fbshipit-source-id: 7e5fcfa2fbb48b6c6279da46cc648a071ff2b079
Summary:
1, Change bottom to be based� on height of parent.
2, Respect margin value when layout with right/bottom.
Closes https://github.com/facebook/yoga/pull/552
Differential Revision: D5102090
Pulled By: emilsjolander
fbshipit-source-id: dca291413ffc2027d7628f4c8b8eeeb0b4823bc2
Summary:
Moves the `YGLogger` into `YGConfig` and pass the `YGNodeRef` into the logger to be able to associate the log messages and assertions with the specific node.
Tackles facebook/yoga#530 and facebook/yoga#446
Closes https://github.com/facebook/yoga/pull/531
Reviewed By: astreet
Differential Revision: D4970149
Pulled By: emilsjolander
fbshipit-source-id: b7fcdaa273143ea2fa35861620b2e4d79f04f0af
Summary:
Fixes the sizing of items so that under most scenarios it calcultes its height by it's content for non exact measurings. This introduces a new useLegacyStretchBehaviour flag on the config to opt out of this change as it is breaking.
See facebook/yoga#505
Closes https://github.com/facebook/yoga/pull/506
Reviewed By: astreet
Differential Revision: D4954016
Pulled By: emilsjolander
fbshipit-source-id: d28bd5d174cd76951fb94df85e3b0cfab7f81ff7
Summary:
Nodes with a measure function needs to be measured even so it seems there is no available space. So it behaves more like on the web. Fixfacebook/yoga#488
Closes https://github.com/facebook/yoga/pull/499
Reviewed By: astreet
Differential Revision: D4954008
Pulled By: emilsjolander
fbshipit-source-id: 5b6d9afae0cdebe33f8b82b67620b3b4527d1efc
Summary:
Fixes `flex-wrap` with a max constraint and `justify-content`. Fixesfacebook/yoga#514.
Closes https://github.com/facebook/yoga/pull/519
Differential Revision: D4953727
Pulled By: emilsjolander
fbshipit-source-id: 32dec48220be1392ea8dac5f34871d407eb8d49b
Summary:
Nodes with a measure function needs to be measured even so it seems there is no available space. So it behaves more like on the web. Fixfacebook/yoga#488
Closes https://github.com/facebook/yoga/pull/499
Differential Revision: D4850458
Pulled By: emilsjolander
fbshipit-source-id: be5e35a670ddcbf3cd426fc3c2a0c9b60a874cdc
Summary:
Fixes the sizing of items so that under most scenarios it calcultes its height by it's content for non exact measurings. See facebook/yoga#505
Closes https://github.com/facebook/yoga/pull/506
Differential Revision: D4878875
Pulled By: emilsjolander
fbshipit-source-id: ab1174ac7a76dcf20aae7b29a3bc396e11077c4d
Summary:
If a min constraint exists. It incorrectly reduces the available space by that amount. This adds a test and fix for this.
Closes https://github.com/facebook/yoga/pull/501
Differential Revision: D4867146
Pulled By: emilsjolander
fbshipit-source-id: ceafe070bfe7f501929d316656ac44c4e1753059
Summary:
If the root node has a position and we have a RTL layout, that position must be like LTR direction. See #477.
Closes https://github.com/facebook/yoga/pull/502
Differential Revision: D4867144
Pulled By: emilsjolander
fbshipit-source-id: b5ad3d87e7054090da12d7665a3d1abe8496a548
Summary:
- depends on #496
- For memory leak unit test
- Expose the API for C#
Closes https://github.com/facebook/yoga/pull/497
Reviewed By: emilsjolander
Differential Revision: D4796190
Pulled By: splhack
fbshipit-source-id: 99e4e78e8dfb3d459cf6cd7103ab252c3748e5a6
Summary:
See facebook/yoga#453. Optimizes the node log print by generating some enum text via ```enum.py``` and moving printing to new functions to reduce boilerplate code.
Changes the log output to format the nodes in html to be able to copy paste it into browsers for quick debugging.
Hides all default values.
Closes https://github.com/facebook/yoga/pull/479
Reviewed By: gkassabli
Differential Revision: D4802184
Pulled By: emilsjolander
fbshipit-source-id: 143bd63cbc31fb0755d711062cb4e6a448049ba3
Summary:
Various fixes of xcode projects and cleaning up some warnings
Closes https://github.com/facebook/react-native/pull/13109
Differential Revision: D4762652
Pulled By: lacker
fbshipit-source-id: b452976a58962439de4adecc8e703264af40cb38
Summary: This is breaking because it affects the contract for onBatchComplete, but modules really shouldn't (and probably aren't) depending on it being called without any actual native module method calls having happened.
Reviewed By: javache
Differential Revision: D4715656
fbshipit-source-id: 53ddd4a26c9949de86f5111d214b3e5002ca2e94
Summary:
This fixes ```align-content: center``` and ```align-content: flex-end``` when the child exceeds the parents size. See #476. It also fixes those layouts if the child has ```margin: auto``` set.
Closes https://github.com/facebook/yoga/pull/477
Differential Revision: D4697833
Pulled By: emilsjolander
fbshipit-source-id: d081ec7ea559a5f2bd3271c3a4dc272960beddfa
Summary:
We have some resolve functions with ```YG**Resolve``` and others named ```YGResolve**```. This changes both to be named like the later one, as I think this is the grammatically better readable one.
Closes https://github.com/facebook/yoga/pull/471
Differential Revision: D4688997
Pulled By: emilsjolander
fbshipit-source-id: 38b5f84d4d39ed3effedf08188085b9efd96b4ce
Summary:
This adds some improvements to the new ```YGConfig```, it tackles #452 and moves the scalefactor into the config.
Closes https://github.com/facebook/yoga/pull/457
Differential Revision: D4675088
Pulled By: emilsjolander
fbshipit-source-id: 99b2c734d6c5139fe1dc8bdeb014bb038f0e337d
Summary:
We need to take the margin into account if we clip on max dimension. Fixes#466.
Closes https://github.com/facebook/yoga/pull/467
Differential Revision: D4681342
Pulled By: emilsjolander
fbshipit-source-id: 56311df9864a284d553c31f1c6db382f337f1fad
Summary:
The issue is on ARM builds for Windows UWP. For the C# P/Invoke API wrapper, any native method that returns the YogaValue struct throws the AccessViolationException. The issue is not with structs in general, as returning the YogaSize / YGSize struct works fine. The issue seems to be limited to structs that have an enum member.
I tried a number of things to resolve the issue without changing the underlying native API for Windows. I read the ARM documentation and saw reference to variable enum sizes based on the number of enum members, so I tried to use a number of different UnmanagedType values in a [MarsalAs()] attribute on the enum member of the C# struct declaration.
What ultimately worked was to return a pointer to the location of the struct, and use the System.Runtime.InteropServices.PtrToStructure API to read the struct data from that pointer. I added a few new macros that will return the struct address on Windows only, other builds are not affected.
Note, I have not tested the impact of this ch
Closes https://github.com/facebook/yoga/pull/459
Reviewed By: emilsjolander
Differential Revision: D4652278
Pulled By: splhack
fbshipit-source-id: bf7ada4da1781e3f813b3ba331974b7bded476d9
Summary:
If we set ```display:none``` all children are set with layout sizes/values of 0. We need do mark all those children as dirty to force a relayout if we toggle the display on a higher parent node. This fixes#443
Closes https://github.com/facebook/yoga/pull/448
Reviewed By: astreet
Differential Revision: D4642273
Pulled By: emilsjolander
fbshipit-source-id: dfdb920e2049952bd6c7f48cfa53b1448e1f3e8f
Summary:
This sets the new ```YGExperimentalFeatureMinFlexFix``` explicitly to false in the config.
It also a changes a stretch reason to reflect that it is the strech in a multiline.
Closes https://github.com/facebook/yoga/pull/447
Reviewed By: astreet
Differential Revision: D4642275
Pulled By: emilsjolander
fbshipit-source-id: 26777db7008ff6ee86da72ca9ea19e979b916cc9
Summary:
Use ```float``` for calculation, as we would calculate with ```double``` and cast to float afterwards otherwise. So this removes the warning.
Closes https://github.com/facebook/yoga/pull/450
Reviewed By: astreet
Differential Revision: D4642267
Pulled By: emilsjolander
fbshipit-source-id: 184ef24474f2b8a42654a71a8e98839296648b2b
Summary:
Move configuration to new ```YGConfig``` and pass them down to CalculateLayout. See #418 .
Adds ```YGConfigNew()``` + ```YGConfigFree```, and changed ```YGSetExperimentalFeatureEnabled``` to use the config.
New function for calculation is ```YGNodeCalculateLayoutWithConfig```.
Closes https://github.com/facebook/yoga/pull/432
Reviewed By: astreet
Differential Revision: D4611359
Pulled By: emilsjolander
fbshipit-source-id: a1332f0e1b21cec02129dd021ee57408449e10b0
Summary:
Changed the flex getters to return the values they were actually set. See #421 .
Closes https://github.com/facebook/yoga/pull/431
Reviewed By: astreet
Differential Revision: D4604744
Pulled By: emilsjolander
fbshipit-source-id: 02d79100ef22be866db1c3bd9d53e4447186811f
Summary:
Fix for #413. This was a hangover from a previous attept to fix other align-content problems.
Closes https://github.com/facebook/yoga/pull/417
Reviewed By: astreet
Differential Revision: D4604727
Pulled By: emilsjolander
fbshipit-source-id: 92fd31a385d8182c6b201c891d5ae478372d525d
Summary:
Since we are reading from a file, we should make sure this struct is packed, just in case we change it down the line and the compiler decides it might want to introduce padding, we're now protected against that.
There was also a discussion about the fact that people might use `ptr += sizeof(BundleHeader)` as an idiom in their code, which would currently be incorrect, if padding was introduced at the end of the file. Actually, it remains incorrect to do that now, because a RAM bundle header is a different size to a BC Bundle header. If people are properly testing their code, they should spot this pretty quickly, because it will always be an incorrect thing to do with a RAM bundle, so this isn't as bad as previously thought: where the code only succeeds when the compiler deigns to not pad the struct at the end.
This diff also cleans up how headers are initialised. `BundleHeader` has a constructor that explicitly zero-initialises it so we can rely on the default initializer to do the right thing now.
Reviewed By: mhorowitz
Differential Revision: D4572032
fbshipit-source-id: 7dc50cfa9438dfdfb9f842dc39d8f15334813c63
Summary: I broke Circle CI builds by moving a file, so I am updating the OSS build setup with details of the move. Whilst I was testing the change, I noticed that the UI Explorer build was also already broken, so this diff also changes some of its configuration to make it build again.
Reviewed By: javache
Differential Revision: D4579137
fbshipit-source-id: 4cbb1ef148075280b991cbc5bb47bf96ec3d543a
Summary:
This PR removes some duplicate code by calculating with ```mainSize```/```crossSize``` and converting that to ```width``` or ```height``` at the end. See #395 .
Closes https://github.com/facebook/yoga/pull/396
Reviewed By: astreet
Differential Revision: D4564713
Pulled By: emilsjolander
fbshipit-source-id: 0b24e69cc9dc75cdf93deeb6c076dcacf134c6d8
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:
In order for `CxxModule` modules to be able to do things like emit events, we need to expose the bridge instance.
To allow classes derived from `CxxModule` in other projects to include `<cxxreact/Instance.h> I also needed to convert all the header includes to non-relative ones.
Reviewed By: javache
Differential Revision: D4564145
fbshipit-source-id: a5bc28dd9b40e2b141af9e867105c56083fbdcdc
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:
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:
Fixes#11272Fixes#11572Fixes#11781
The main changes here are:
* This depends on the latest CocoaPods (1.2.0). It’s currently in RC, but if I’m not mistaken a proper release is expected soon. /cc dantoml
* Adds required header search paths for the jschelpers and cxxreact subspecs.
* Makes the jschelpers and cxxreact headers private to building React Native, not visible to the user’s project.
* It uses the canonical upstream Yoga v1.0.0 podspec: https://github.com/facebook/yoga/blob/master/Yoga.podspec
* Consistent styling.
I have been able to get our app to build again using this https://github.com/artsy/emission/pull/437. The spec has some warnings, but otherwise fully passes lint.
rh389 sjmueller Could you please test with your projects?
Closes https://github.com/facebook/react-native/pull/12089
Differential Revision: D4518605
fbshipit-source-id: ecf86232d8b1af52d139eadd1acc10f5c1d42c29
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:
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:
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: Cannot use NSInteger as NSInteger has a different size than int (which is the default type of a enum). Therefor when linking the Yoga C library into obj-c the header is a missmatch for the Yoga ABI.
Reviewed By: cwdick
Differential Revision: D4392272
fbshipit-source-id: 22b92ac8f3eb7114e81dbd9b0bec9044c3d43da5
Summary:
Compared to what was planned, I added the `overflow` value which seemed missing. I had to modify the implementation a bit for all values which are backed by a `YGValue`, but we should probably enable the pixel dimensions in Objective-C and Swift somehow later.
Closes https://github.com/facebook/yoga/pull/322
Reviewed By: cosmin1123
Differential Revision: D4391434
Pulled By: emilsjolander
fbshipit-source-id: e33f6f7b2bbaad29553100b7a5bb424496372110
Summary:
Compared to what was planned, I added the `overflow` value which seemed missing. I had to modify the implementation a bit for all values which are backed by a `YGValue`, but we should probably enable the pixel dimensions in Objective-C and Swift somehow later.
Closes https://github.com/facebook/yoga/pull/322
Reviewed By: dshahidehpour
Differential Revision: D4386906
Pulled By: emilsjolander
fbshipit-source-id: 05ac0e571ef3a8ff0be31469e449a7b23f102218
Summary:
Added baseline support (see #132)
You have the ability for a custom baseline function (```float(*YGBaselineFunc)(YGNodeRef node);```) to return whatever baseline you want.
Closes https://github.com/facebook/yoga/pull/317
Reviewed By: splhack
Differential Revision: D4385061
Pulled By: emilsjolander
fbshipit-source-id: cb8a59a09237c840fa3e21753ab68239997dab0c
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
Summary:
Not re-calculate `paddingAndBorderAxisMain`/`paddingAndBorderAxisCross`/`paddingAndBorderAxisRow`/`paddingAndBorderAxisColumn` in Step1 of `YGNodelayoutImpl`.
They can be figure out by values calculated before.
Closes https://github.com/facebook/yoga/pull/298
Reviewed By: dshahidehpour
Differential Revision: D4365533
Pulled By: emilsjolander
fbshipit-source-id: 6caf60bc6ef3addd49915b39b48f01a8b4926e9c
Summary: AspectRatio is a new addition and soon after introduction we noticed use cases which is did not support. Specifically we wanted to support a node being as large as possible within a container while maintaining an arbitrary aspect ratio. This was not possible due to the low priority of AspectRatio, by increasing the priority of AspectRatio this is now possible as FlexGrow will grow an item to fit its parent unless the AspectRatio makes it too big in the cross axis, the AspectRatio will now override the FlexGrow in the main axis in that case.
Differential Revision: D4346720
fbshipit-source-id: 1f15613604190e3ad5ff4a467ba57db4bcfd2741
Summary: Aspect ratio being defined as width/height or height/width depending on the situation it was used in turned out to be very confusing. This diff makes aspect ratio always be defined as width/height irregardless of the usage.
Differential Revision: D4339132
fbshipit-source-id: e5da32750b55ddaf6acaf1cbd7662d86f2b480c3