Live data from Hacker News

Yoga: A cross-platform layout engine

code.facebook.com

111–120 of 168 posts

Re: Yoga: A cross-platform layout engine

#111
post #78

Using the name "Yoga" for your software is cultural appropriation. Facebook should not do it. It is equivalent of naming a sports team Rednecks.

Is Yoga a derogatory term? I've never heard it used in such a way, so I think that's quite the false equivalence.

Re: Yoga: A cross-platform layout engine

#112
post #90
post #87

Earlier quoted context omitted.

This is one of the reasons companies seek patents, called a defensive patent strategy. The goal is to discourage competitors from suing you for patent violations by making sure you own a patent your competitors are likely to have violated. It creates a kind of "mutually assured destruction" that discourages either party from launching a patent war (this only works against real competitors, not against patent trolls,…

Let's say I have a patent for a technology outside of React, and even outside of software, such as some hardware patent. Why should me suing for infringement of that patent preclude me from using React when it (the patent infringement and React) are completely independent?

Because facebook said so in their README. Demands don't need to make sense but they need to be observed (whether that means respecting the demands or avoiding the people, the companies and the products that make such demands and thus not being affected in the first place).

Re: Yoga: A cross-platform layout engine

#113
post #89
post #62

One thing I've thought about recently is Facebook's Patent grants, and it's one thing that makes me uneasy about using any open source technology from Facebook like React (I currently do but am thinking to move to Preact because of the nicer MIT license and that it's analogous to React in many ways) because they're generally given a patent grant. I'm not a lawyer so I don't know if the grant would hold up in court si…

I am curious to hear of anyone who has reviewed this license with their lawyers / legal departments and received a positive, non-cautionary response to go ahead and use the software and libraries covered under it.

The React wiki has a non exhaustive list of users[0] which includes some rather large companies (BBC, Airbnb, Automattic, Atlassian, eBay, Netflix, etc.). I presume most of those larger companies had their legal departments approve its use.

[0] https://github.com/facebook/react/wiki/Sites-Using-React

Re: Yoga: A cross-platform layout engine

#114
post #79

Earlier quoted context omitted.

I never said that you could lose your license for competing against Facebook, I said that you could lose your license if you have a patent and assert it against Facebook if it infringes. This is the patent grant from React, which is identical to the grant in the post's repo as well. The language in the patent grant is pretty clear and doesn't mention anything about React specifically: The license granted hereunder wi…

If you name React in your patent lawsuit against Facebook, your license for React is terminated. Other software licenses remained unaffected. That seems like a pretty reasonable stance for distributing an open source project.

IANAL but isn't the text quoted above also saying that except if initiated by Facebook suing you over a patent first, any patent lawsuit against facebook will terminate your license? It's listing "(i), (ii) or (iii)", not "(i), (ii) and (iii)".

Re: Yoga: A cross-platform layout engine

#115

I like the concept and the C# code is just hands down the best example out of all of them (yet another reason I miss coding in C#). I'm curious though, will this be eventually ported to JavaScript? Yeah yeah I know "flexbox is already on the web!" but if you could write a layout in this fashion versus using style sheets then you could take it and directly apply it to any of your applications (even if you have to conv…

I found it kind of ironic that their tests in .NET for the C# code only run on MacOS currently! :) So hard to remember that finally we are in a world where that is possible.

"We have a script which to launch C# test on macOS, csharp/tests/Facebook.Yoga/test_macos.sh."

Re: Yoga: A cross-platform layout engine

#116
Static layouts are hardly "complex." The complexity comes from animating between different layout states, animating elements in a list, animating elements relative to other elements (e.g., parallax), animating element size changes, etc.

It seems confusing to me to have "layout" as a separate component rather than having it be tightly integrated with the rest of the UI framework.

Re: Yoga: A cross-platform layout engine

#117
post #66

I like the concept and the C# code is just hands down the best example out of all of them (yet another reason I miss coding in C#). I'm curious though, will this be eventually ported to JavaScript? Yeah yeah I know "flexbox is already on the web!" but if you could write a layout in this fashion versus using style sheets then you could take it and directly apply it to any of your applications (even if you have to conv…

I'm not sure how you're supposed to use this from C# in real life, though. Ok, you have a layout engine. For what widgets? Windows.Forms? WPF? Xamarin Forms? Can those even use a third party layout engine? I'm slightly confused :)

To be honest, I'm a .NET developer and I'm not entirely sure either. None of the tests they wrote show any integration with existing widget engines.

One thought I had is that one could use this layout engine to do the calculations for the positioning of visual objects on the screen, but you would have to essentially build a fully integrated layout manager that renders to the particular framework you're using. Maybe overridding the hooks for existing layout managers that come with the particular UI framework (for example, WPF has layout managers).

For example, in WinForms, if you build the UI programmatically rather than old fashioned drag-and-drop, you could set X/Y positions, widths/sizes etc. per the constraints generated by this engine. Needs to be observable/reactive so the UI changes are fed back into the engine and then the UI automatically changes - much like existing layout manager tech.

Perhaps doing this work/exercise was left to the open source community/reader. There aren't any examples/tests showing how to integrate this layout manager with any existing .NET UI widget frameworks. It looks like they wrote the integration with .NET in C# (on MacOS as well), and tested the layout engine itself, but that's about it.

EDIT: Possible hooks for old WinForms maybe? https://msdn.microsoft.com/en-us/library/z9w7ek2f(v=vs.110)....

Re: Yoga: A cross-platform layout engine

#118

I like the concept and the C# code is just hands down the best example out of all of them (yet another reason I miss coding in C#). I'm curious though, will this be eventually ported to JavaScript? Yeah yeah I know "flexbox is already on the web!" but if you could write a layout in this fashion versus using style sheets then you could take it and directly apply it to any of your applications (even if you have to conv…

I believe the canonical JS implementation is (or will be?) https://github.com/jordwalke/ReLayout - written in Reason and compiled to JS via Bucklescript. Lots of very nice reasons and benefits for this, including readable JS with good performance.

Re: Yoga: A cross-platform layout engine

#119

Earlier quoted context omitted.

Yoga itself does not handle animation but by using another animation system on top of Yoga it should be very possible. I have not yet tried it myself but by wrapping a layout change in a UIView animation block the above should be doable (on iOS but similar should hold on other platforms).

Interesting. Could it be done efficiently? I.e., without walking the complete tree on every update?

It's platform specific, as I understand Yoga, it's just a nicer way to write UI code as I see it. On iOS for example, you should totally be able to wrap it be able to wrap Yoga code in existing animation engine, like UIView animation, layer animations and UIKit dynamics. So it'll be as efficient as the system its running on implemented its layout and animation engine. In the case of iOS, it would be amazingly efficient.

Re: Yoga: A cross-platform layout engine

#120
post #67
post #54

Okay, question: can it perform the following task elegantly? Say, I build a declarative tree describing a layout, and I render it. Now I remove one item from the tree. Can the layout engine efficiently remove the item from the view, and... (now it comes) provide an animation for it? As in, the item slowly losing opacity, then the surrounding items moving closer together? (Or a different animation depending on setting…

Animation effects like this are more annoying than anything else, anyway.

No it's not, nicely done animations, and I'm not saying over the top animation, can ease context changes for example. It's better to have an object moving to its new place than to have an object disappear and reappear somewhere else on the screen.
Post reply on HN