# Migrate from react-native-signature-canvas

> Switch from react-native-signature-canvas to Patine UI's SignaturePad: no WebView, the strokes as data, an SVG export, a built-in Clear button and a screen-reader Clear action.

# Migrate from `react-native-signature-canvas`

```diff
- import SignatureScreen from 'react-native-signature-canvas';
+ import { SignaturePad, signatureToSvg } from 'patine-ui';

- <SignatureScreen ref={ref} onOK={(dataUrl) => upload(dataUrl)} onEmpty={warn} descriptionText="Sign" penColor="#111" />
+ <SignaturePad value={strokes} onValueChange={setStrokes} strokeColor="#111" labels={{ placeholder: 'Sign' }} />
+ <Button onPress={() => upload(signatureToSvg(strokes, { width, height }))}>Save</Button>
```

| react-native-signature-canvas | Patine UI |
| --- | --- |
| `onOK(dataUrl)` (PNG) | `signatureToSvg(strokes, { width, height })` (SVG) or `signatureToPath(strokes)` |
| `onEmpty` | `isSignatureEmpty(strokes)` |
| `ref.clearSignature()` | `setStrokes([])`, or the built-in Clear button |
| `ref.undo()` | `setStrokes(strokes.slice(0, -1))` |
| `penColor` / `minWidth` / `maxWidth` | `strokeColor` / `strokeWidth` |
| `descriptionText` / `clearText` | `labels.placeholder` / `labels.clear` |
| `onBegin` / `onEnd` | `onBegin` / `onEnd` |
| `webStyle` | `style` and the design |

There's no WebView: [`SignaturePad`](../../components/signature-pad) draws with plain views and keeps the strokes as points, which you can store and draw again exactly. For a PNG, render the SVG with your image tooling.

See [all migration guides](./index.mdx) for other libraries, and [Comparison](../comparison.mdx) for when another library is the better choice.
