nitro-ui-sketch
nitro-ui-sketch is a PencilKit-style ink canvas for NitroUI apps on iOS and Android. It gives you pressure- and tilt-sensitive inks, stroke and pixel erasers, lasso selection, a ruler, zoom, undo, and PNG, JPEG, SVG and PDF export, plus a themeable tool picker to drive them.
One C++ ink engine renders with tgfx: Metal on iOS, OpenGL ES on Android. Touches never cross into JavaScript; you observe the result through callbacks and a controller.
import { useState } from 'react'
import { Drawing, SketchCanvas } from 'nitro-ui-sketch'
export function Notes() {
const [drawing] = useState(() => new Drawing())
return (
<SketchCanvas
layout={{ flex: 1 }}
drawing={drawing}
tool={{ type: 'ink', ink: 'pen', color: 0x1e88e5ff, width: 4 }}
/>
)
}
What's in the package
| Export | What it does |
|---|---|
SketchCanvas | The native ink canvas view. |
CanvasController | Imperative control of a mounted canvas: viewport, selection, listeners. |
Drawing | Strokes with undo history, serialization and export. Works without a canvas. |
Stroke | One immutable stroke and its points. |
ToolPicker | A PencilKit-style palette of instruments, colours, widths, undo/redo and the ruler. |
| Tool picker parts | The picker's building blocks, exported for custom layouts. |
GlassBackground | A Liquid Glass backdrop on iOS 26 and later, with a solid fallback. |
Compared with PencilKit
| Feature | nitro-ui-sketch | PencilKit |
|---|---|---|
| iOS | ✅ | ✅ |
| Android | ✅ | ❌ |
| macOS / visionOS | ❌ | ✅ |
| Pen | ✅ | ✅ |
| Monoline | ✅ | ✅ |
| Fountain pen | ✅ | ✅ |
| Marker | ✅ | ✅ |
| Pencil | ✅ | ✅ |
| Crayon | ✅ | ✅ |
| Watercolor | ✅ | ✅ |
| Reed | ❌ | ✅ |
| Pressure and tilt | ✅ | ✅ |
| Stroke eraser | ✅ | ✅ |
| Pixel eraser | ✅ | ✅ |
| Lasso selection | ✅ | ✅ |
| Selection from code | ✅ | ❌ |
| Ruler | ✅ | ✅ |
| Zoom and pan | ✅ | ✅ |
| Undo and redo | ✅ | ✅ |
| Stylus-only drawing | ✅ | ✅ |
| Tool picker | ✅ | ✅ |
| Themeable tool picker | ✅ | ❌ |
| Colour picker | ✅ | ✅ |
| Apple Pencil double-tap | ❌ | ✅ |
| Apple Pencil squeeze | ❌ | ✅ |
| Stroke and point access | ✅ | ✅ |
| Save and load drawings | ✅ | ✅ |
| PNG / JPEG export | ✅ | ✅ |
| SVG export | ✅ | ❌ |
| PDF export | ✅ | ❌ |
Requirements
| Requirement | Version |
|---|---|
nitro-ui-renderer | 0.3.0 or later |
react | 19.2.0 or later |
nitro-core | 1.0.0-alpha.nightly.137.gd4793c40b8b8, exactly |
| iOS | 16 or later; Liquid Glass needs iOS 26 |
| Android | The Android SDK and NDK your NitroUI release requires |
Conventions
- Colours are
0xRRGGBBAAnumbers:0x1e88e5ffis opaque blue. - Sizes and positions are content points. Zoom changes how many view points one content point covers, not the stroke data.
Next steps
- Install the package and generate its bindings.
- Follow the quick start to add a canvas and a tool picker.
- Browse the guides or the API reference.