Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1712 tsia, add some more advanced tests checking * percent widths/heights/padding/border * absolute positioned nodes with content box * containing block with content box + static * flex basis (fails now, needs follow up) * relative padding/border values All pass but flex basis Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D63423302 fbshipit-source-id: d117d305072e254af57eaab03a6349176e759327
yoga-layout
This package provides prebuilt WebAssembly bindings for the Yoga layout engine.
See more at https://yogalayout.dev
Usage
import {Yoga, Align} from 'yoga-layout';
const node = Yoga.Node.create();
node.setAlignContent(Align.Center);
Objects created by Yoga.<>.create()
are not automatically garbage collected and should be freed once they are no longer in use.
// Free a config
config.free();
// Free a tree of Nodes
node.freeRecursive();
// Free a single Node
node.free();
Requirements
yoga-layout
requires a toolchain that supports ES Modules and top-level await.
If top-level-await is not supported, use the yoga-layout/load
entry point instead. This requires to load yoga manually:
import {loadYoga, Align} from 'yoga-layout/load';
const node = (await loadYoga).Node.create();
node.setAlignContent(Align.Center);