Layout engine
SootSim uses Yoga (the same layout engine as React Native) for flexbox computation.
Yoga integration
Every SootSimNode gets a corresponding Yoga node. When the tree is committed, SootSim:
- creates/updates Yoga nodes for new/changed SootSimNodes
- applies style properties as Yoga config
- calls
yogaRoot.calculateLayout()to compute layout - reads computed values (x, y, width, height) back into SootSimNodes
- computes absolute positions by walking the tree
Supported styles
All standard React Native flexbox properties:
flex,flexGrow,flexShrink,flexBasisflexDirection(row, column, row-reverse, column-reverse)alignItems,alignSelf,alignContentjustifyContentflexWrapgap,rowGap,columnGappadding*,margin*,border*Widthwidth,height,minWidth,maxWidth,minHeight,maxHeightposition(relative, absolute)top,left,right,bottomaspectRatiodisplay(flex, none)overflow(visible, hidden, scroll)
Text measurement
Text nodes use CanvasKit’s font metrics to measure text dimensions. The measured size is set on the Yoga node via the measureFunc callback, allowing text to participate in flexbox layout.