nitro-view-shot
nitro-view-shot captures NitroUI views as native images on iOS and Android. It is a Nitro module built with Nitro 1.0 (nitro-core 1.0.0-alpha.nightly.138), with a Swift implementation on iOS and a Kotlin implementation on Android.
import { ViewShotView, type ViewShotViewRef } from 'nitro-view-shot'
const shot = useRef<ViewShotViewRef>(null)
// <ViewShotView ref={shot}>…</ViewShotView>
const image = await shot.current?.capture() // nitro-ui-renderer Image
What it does
| Capability | Details |
|---|---|
| Capture a component | Wrap content in ViewShotView and call capture() on its ref. |
| Capture any view | Pass a mounted NitroUI ViewRef to ViewShot.capture. |
| Native result | Resolves to a nitro-ui-renderer Image: encode it to PNG or JPEG, base64, or raw pixels. |
| Pixel density | Renders at the display's pixel density; width and height are in pixels. |
| Color | 8-bit sRGB with alpha on both platforms. |
| Subtree only | Views drawn over the target are left out; parts an ancestor scrolls or clips out of sight are included. |
Requirements
| Requirement | Version |
|---|---|
nitro-ui-renderer | 0.3.0 or newer |
react | 19.0.0 or newer |
| iOS | 16+ (NitroUI's minimum) |
| Android | API 26+ (NitroUI's minimum) |
nitro-core | 1.0.0-alpha.nightly.138.g43e09c161101, exactly; see Installation |
Next steps
- Install the package and pin
nitro-core. - Capture your first view.
- Read what a capture includes in Capturing views.