Native Engine

Architecture

How Nitrowind connects compiled CSS, the C++ runtime, Fabric ShadowTree updates, and native iOS and Android effects.

Native Engine Architecture

The native engine lives in nitrocss. It combines a shared C++ runtime with small platform drivers for effects that need UIKit or Android View APIs.

Core pieces:

PieceRole
Metro compilerConverts CSS and Tailwind utilities into flattened native style tables.
NitroCssEngineResolves class-name buckets against the current runtime state.
DependencyIndexTracks linked nodes by theme, dimensions, safe area, container, and state dependency.
ShadowTreeMutatorClones props and commits updates to the Fabric ShadowTree.
ScrollTimelineTargetsShares compiled scroll sources, animation targets, ranges, and keyframes.
iOS scroll timeline driverReads UIScrollView progress and applies interpolated frames to native views.
Android scroll timeline driverReads Android scroll progress and applies the same compiled timeline model.
Nitro specsDefine generated bindings between JavaScript, Swift/Kotlin, and C++.
Platform HybridObjectsRead platform appearance, dimensions, insets, and configuration.

Update flow

  1. Metro compiles authored CSS into style tables and native effect descriptors.
  2. JavaScript performs the initial style resolution and links the mounted Fabric node.
  3. The C++ dependency index records which runtime values can affect that node.
  4. Theme, color-scheme, dimension, safe-area, container, and interaction changes re-resolve only the linked nodes that depend on them.
  5. The ShadowTree mutator commits supported prop changes without a React re-render.

Scroll-driven animations use the same compiled descriptors but are sampled by the platform scroll drivers. Both iOS and Android interpolate supported keyframes from native scroll position without a JavaScript onScroll loop. See Scroll-Driven Animations for supported timelines, ranges, axes, and properties.

On this page