Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1646 X-link: https://github.com/facebook/react-native/pull/44069 Fixes https://github.com/facebook/yoga/issues/978 1. Don't allow auto margin spaces to become a negative length 2. Replicate fallback alignment behavior specified by box-alignment spec that we are using for align-content. Reviewed By: joevilches Differential Revision: D56091577 fbshipit-source-id: 3c02f81f969bb947cdc5c80b15faaa0b0d39c0c2
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);