Rendering pipeline
Overview
SootSim uses a custom React reconciler that creates SootSimNode objects instead of DOM elements. These nodes are laid out with Yoga and rendered to a <canvas> via CanvasKit (Skia WASM).
Reconciler
The reconciler (engine/reconciler.ts) implements the react-reconciler host config:
createInstance()— creates a SootSimNode with style resolutionappendChildToContainer()— adds to the root nodecommitUpdate()— diffs props and updates the noderemoveChild()— removes from parent
Node tree
Each SootSimNode stores:
- resolved styles (RN style objects → flat properties)
- Yoga layout node reference
- children array
- absolute position (computed after layout)
- accessibility metadata
Layout
Yoga computes flexbox layout in a single pass. SootSim maps RN style props to Yoga node properties:
- flex, flexDirection, alignItems, justifyContent
- padding, margin, border
- width, height, minWidth, maxWidth
- position (absolute/relative), top/left/right/bottom
Canvas rendering
The CanvasKit renderer traverses the node tree depth-first:
- apply clipping (overflow: hidden, border radius)
- draw background color
- draw borders
- draw shadows
- draw text (with font metrics)
- draw images
- recurse into children
- draw scroll indicators and fade gradients