Migrate from react-native-signature-canvas
- 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 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 for other libraries, and Comparison for when another library is the better choice.