mirror of
https://github.com/hanzoai/yoga.git
synced 2026-10-30 19:34:29 +00:00
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1648 Node made a breaking change in a security release for 18/20 where `spawn()` no longer loads `.bat` files by default. https://github.com/nodejs/node/commit/69ffc6d50dbd9d7d0257f5b9b403026e1aa205ee. Execute command in shell. Reviewed By: javache Differential Revision: D56230965 fbshipit-source-id: 52e9bd8a76664bd07ea25b6355ac54fcb24cbb9a
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);