React Native View Recorder
API Reference

SnapshotOptions

Configuration options for capturing a view as an image

SnapshotOptions is the configuration object passed to recorder.snapshot() or takeSnapshot(). It controls the output format, size, and result type.

Options

OptionTypeDefaultDescription
outputstring-Absolute path for the output image file. Required when result is "tmpfile".
formatSnapshotFormat"png"Image format. PNG is lossless; JPG is lossy but smaller.
qualitynumber0.9Compression quality from 0.0 (smallest) to 1.0 (best). Only applies to "jpg" format.
widthnumberView's pixel widthOutput image width in pixels.
heightnumberView's pixel heightOutput image height in pixels.
resultSnapshotResult"tmpfile"Output type. "tmpfile" writes to disk and returns the file path. "base64" returns the image data as a base64-encoded string.

Types

SnapshotFormat

type SnapshotFormat = "png" | "jpg";

SnapshotResult

type SnapshotResult = "tmpfile" | "base64";

Standalone function

If you need to take a snapshot without the hook, use the standalone takeSnapshot function:

import { takeSnapshot } from "react-native-view-recorder";

const uri = await takeSnapshot(sessionId, {
  output: "/path/to/photo.png",
  format: "png",
});

This is useful when you have the sessionId but not the hook handle, for example in a utility function or class component.

On this page