Interface: SignatureInkHandle
Imperative API exposed via ref. All async methods resolve once the native side has finished its work.
Properties
| Property | Type | Description |
|---|---|---|
clear | () => void | Clear the canvas and the redo stack. On iOS the clear is a history entry that undo() can restore; on Android it also discards the history and cannot be undone. |
copyToClipboard | () => void | Copy a PNG of the trimmed signature to the system clipboard. On iOS this uses UIPasteboard.general.image. On Android the bitmap is written to the app cache and a content:// URI (served by the library's bundled FileProvider) is placed on the primary clip. |
getStrokeData | () => Promise<StrokeData> | Resolves with a JSON-serializable copy of the strokes. |
isEmpty | () => Promise<boolean> | Resolves with true when there are zero strokes on the canvas. |
redo | () => void | Re-apply the most recently undone stroke. No-op when the redo stack is empty. |
replay | (options?) => void | Animate the existing strokes as if the user were drawing them again. Cancellable: any new stroke (or another replay() call) aborts the current animation. undo, redo, clear and setStrokeData also stop it. An interrupted replay leaves only the strokes revealed so far. |
saveToPhotoLibrary | (options?) => Promise<SavedToPhotoLibraryResult> | Save the rendered signature to the OS photo library. - iOS prompts the user the first time for "Add Photos" permission; the host app must declare NSPhotoLibraryAddUsageDescription in its Info.plist or the system will crash the app. - Android (API 29+) writes into MediaStore.Images.Media.EXTERNAL_CONTENT_URI under Pictures/Signatures/ with no runtime permission needed. On API 28 and below, declare WRITE_EXTERNAL_STORAGE in the host AndroidManifest.xml. |
setStrokeData | (data) => void | Replace the canvas contents with the given stroke data. Strokes are drawn with the current penColor and pen widths (the payload carries neither). Invalid input is ignored. On iOS the replacement can be undone. On Android the previous drawing is discarded and undo() removes the restored strokes one at a time. |
toBase64 | (options?) => Promise<string> | Resolves with a base64-encoded image of the canvas. The returned string is the raw payload (no data: URI prefix). |
toFile | (options?) => Promise<string> | Writes the rendered image to a file in the app's temporary directory and resolves with the file:// URI. |
toSvg | () => Promise<string> | Resolves with an SVG document representing the current strokes, one <path> per stroke, cropped to the strokes' bounds. Coordinates are points on iOS and physical pixels on Android. |
undo | () => void | Step one entry back through history. No-op when the undo stack is empty. On iOS an entry is a stroke, a clear() or a setStrokeData(); on Android undo() always removes the last stroke. |