BakeNative is under active development. APIs may change.
Skip to Content
BakeNative

Rendering

Why native screens match the web build, and what each platform does.

Most cross-platform frameworks map your components onto platform widgets and let each platform lay them out. That is why the same app looks a little different on every platform. BakeNative does the opposite. One shared engine computes everything that decides how a screen looks. Each platform only displays the result.

The shared engine

The engine is the BakeNative Rust core. Every native target (iOS, macOS, Android, Windows) runs the same code for these steps:

StepWhat it does
CSSA cascade modeled on Chromium: Chromium's default (user-agent) stylesheet, selectors, specificity, inheritance, custom properties, media queries and computed values that getComputedStyle reports
LayoutBrowser-compatible block, flex and grid layout of an html > body > #root page
Line breakingLines, line height, alignment, letter spacing and decorations. The platform's text system resolves fonts, shapes runs and draws glyphs; the engine decides where lines break. Measuring and drawing use the same shaped runs
Motiontransform, transition and @keyframes (opacity, transform, background color) become motion records that the platform runs

The default stylesheet

Elements start from Chromium's default stylesheet (Blink's html.css), because Chromium is the reference every platform is compared against. That covers the body's 8px margin, heading sizes and margins, paragraph and list spacing, pre and code in monospace, link color and underline, mark, small, sub / sup, hr, fieldset and legend, and the form controls: a 13.33px control font, 1px 2px input padding, 1px 6px button padding, monospace textareas, and the checkbox, radio and range margins.

System colors (Canvas, CanvasText, ButtonFace, Field, LinkText, Highlight…) and the default canvas use Chromium's own default values, with no mapping to the operating system, so they are the same on every platform: light Canvas #FFFFFF, ButtonFace #EFEFEF, GrayText #808080, LinkText #0000EE, Highlight #1967D2; dark Canvas #121212, ButtonFace #6B6B6B, Field #3B3B3B. Chrome on Windows and macOS takes some light-mode colors from the operating system (on Windows 11, ButtonFace #F0F0F0 and LinkText #0066CC), so it can show different values there. Links in the default stylesheet use the document link colors, #0000EE and #9E9EFF.

A few rules differ from Chromium on purpose:

  • Table elements are block boxes because the engine has no table layout. th stays bold and centered.
  • <img>, <svg> and other replaced elements are inline-block. Chromium lays out an inline replaced element as an atomic inline box, so the result is the same.
  • Controls use the platform's UI font, not Arial. The size of switches, checkboxes, sliders, progress, meters and pickers comes from the platform control.
  • A <dialog> opens as a native sheet, and <summary> has no disclosure triangle.

A screen drawn from the snapshot and the same screen after your app takes it over go through the same engine and the same painter, so they produce the same pixels.

Backends per platform

The platform supplies text, drawing, compositing and accessibility. On the web, the browser does everything, including layout.

PlatformLayoutTextDrawingCompositingAccessibility
WebBrowserBrowserBrowserBrowserBrowser (DOM)
iOSRust coreCoreTextCore Animation layer properties; CoreGraphics for text and SVGCore Animation (UIKit views)UIAccessibility
macOSRust coreCoreTextCore Animation layer properties; CoreGraphics for text and SVGCore Animation (AppKit views)NSAccessibility
AndroidRust coreMinikin shaping, ICU line breaks, Canvas.drawTextRunCanvas in each view's onDraw (hardware display lists)View and RenderNode propertiesAndroid accessibility (View)
WindowsRust coreDirectWriteDirect2D into one DirectComposition surface per box; the shared Skia-port rasterizer (bake-svg) for SVG, rounded boxes, box shadows, rounded outlines and text-shadow blurDirectComposition visualsUI Automation

On every native platform, position, size, opacity, transform and clipping are properties of the platform's view or layer. Moving, fading or transforming a box does not draw it again.

Accessibility

The core keeps one semantic tree for every native target, built from your markup and ARIA attributes: roles, names, values, states, test ids, focus order and live regions. Each host maps that tree to the platform API: UIAccessibility on iOS, NSAccessibility on macOS, an AccessibilityNodeProvider on Android and UI Automation on Windows. Native controls keep their own platform element, named by the core.

  • Containers. On iOS, lists, landmarks, tab lists, dialogs, and groups with a name or a test id are accessibility containers, so VoiceOver's landmark and container rotors find them.
  • Ranges. Sliders, progress bars and spin buttons expose their bounds and value from aria-valuemin / aria-valuemax / aria-valuenow, else from the native control, else from ARIA's defaults. A spin button without bounds is unbounded.
  • Focus. When the platform moves focus (a screen reader, a keyboard), the host sends it to the core, which focuses the element and reports it back. An open <dialog> sheet exposes the dialog's subtree.

bake inspect a11y prints the core's tree from a running debug app (Working with AI agents).

What the platform does

The platform views are thin hosts. For each element that needs a view, the host creates one (or reuses one), sets the frame the engine computed, and draws the box's paint: background, border, radius, gradient, text and SVG. After the first frame, updates touch only what changed: see Runtime performance. The platform contributes what only it can: real text fields, scrolling, input events, and the device's fonts and color scheme.

The built-in views of the adapters, such as View and Text, go through the same engine as HTML elements. Their own host kinds give them a few targeted update paths. See Use built-in views first.

Buttons and text fields start from one shared control stylesheet on every target, the browser included, so a button is the same box everywhere until your CSS says otherwise.

Form controls (switches, checkboxes, sliders, selects, progress, date and color pickers) are the exception, as they are in browsers: each platform draws its own. The engine still lays them out and carries their state into the first-screen snapshot. iOS and macOS show the SwiftUI control in that box, Android the Material 3 control, and Windows draws the control in the Windows 11 (Fluent) style. See Form controls.

Hermes and your app

Your app runs on Hermes, compiled ahead of time to bytecode, so there is no parse or compile step at launch. Each BakeNative view owns its own runtime, and JavaScript runs on a dedicated thread. Your app's updates arrive on the main thread as batches of changes to the element tree, which the engine restyles and lays out, and the platform host applies.

The hosts talk to Hermes through a small C interface (bakenative_hermes.h). On Apple platforms, that is why adding BakeNative to an app does not require turning on Swift/C++ interop. On Windows, the host loads bakenative_hermes.dll on the JavaScript thread, so the process starts without Hermes' DLLs.

On this page