Skip to content

createYogaNode

createYogaNode(): Node

Defined in: ui/src/yoga-helpers.ts:45

Create a new Yoga node, keeping Yoga’s raw defaults — notably flexShrink: 0, so an element keeps its natural main-axis size and overflows a too-small row/column rather than being crushed.

This intentionally does NOT adopt the web’s flexShrink: 1 default. Yoga has no min-width: auto content floor, so a global 1 has nothing to stop it crushing fixed-size siblings, and it collapses scroll content (a ScrollView’s content must exceed its viewport to scroll). Opt into shrinking per element via flexShrink: 1 or the flex shorthand (see applyLayoutProps); to let text wrap, give an ancestor a definite width and mark the text/column flex / flexShrink: 1 so it gives the space back.

Node