# rn-signature-view

> React-Native SignatureView written in Java / Swift

Latest version **1.0.35** (published 2024-03-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install rn-signature-view
pnpm add rn-signature-view
yarn add rn-signature-view
bun add rn-signature-view
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.35 |
| Published | 2024-03-26 |
| First published | 2024-03-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Shankar Sawant |
| Maintainers | shankarsawant81 |
| Keywords | react, react-native, native, signatureview, signaturepad, signature, android, ios |

## Links

- npm: https://www.npmjs.com/package/rn-signature-view
- npm.io page: https://npm.io/package/rn-signature-view

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.35 (latest) — 2024-03-26
- 1.0.34 — 2024-03-26
- 1.0.33 — 2024-03-26
- 1.0.32 — 2024-03-26
- 1.0.31 — 2024-03-26
- 1.0.30 — 2024-03-26
- 1.0.29 — 2024-03-26
- 1.0.28 — 2024-03-26
- 1.0.27 — 2024-03-26
- 1.0.26 — 2024-03-26
- 1.0.25 — 2024-03-26
- 1.0.24 — 2024-03-14
- 1.0.23 — 2024-03-11
- 1.0.22 — 2024-03-11
- 1.0.21 — 2024-03-11
- … 21 more at https://npm.io/package/rn-signature-view/versions

## README

This is signature View for React Native, made with Java / Swift + Objective-C


## Properties

| Prop                                |                   Type                   | Description                                                                                                                                           |
|:------------------------------------|:----------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------|
| addListener |    `(e: Event) => void`           | e: "ON_STARTED" or "ON_CLEARED"                                                                    |

## Methods

| Function                  | Description                                                                                     |
| :--------------------     | :-----------------------------------------------------------------------------------------------|
| onClear()                 | Clear the current signature                                                                     |
| onSave()                  | Returns base64 format of the signature with white background                                    |

To call the methods use the `useRef` hook:

```js
import RNFS from 'react-native-fs';
import {PERMISSIONS, requestMultiple} from 'react-native-permissions';
import SignatureView from 'rn-signature-view';

export default function App() {
  const ref = useRef<SignatureView>(null);

  useEffect(() => {
    requestMultiple(
      Platform.OS === 'ios' ? [PERMISSIONS.IOS.PHOTO_LIBRARY] : [],
    );
  }, []);

  async function onSave() {
    const image_data = await ref.current?.onSave();
    if (!image_data) {
      return;
    }
    const fileName = 'signature_' + new Date().getTime().toString() + '.png';
    const file_path = RNFS.DocumentDirectoryPath + '/' + fileName;
    RNFS.writeFile(file_path, image_data, 'base64').then(() =>
      CameraRoll.saveAsset(file_path, {}),
    );
  }

  async function onClear() {
    ref.current?.onClear();
  }

  return (
    <SafeAreaView style={styles.container}>
      <View style={styles.padContainer}>
        <SignatureView
          ref={ref}
          addListener={e => console.log(e.nativeEvent.event)}
        />
      </View>
      <Button title="Save" onPress={onSave} />
      <Button title="Clear" onPress={onClear} />
    </SafeAreaView>
  );
}
```

---
_Source: https://npm.io/package/rn-signature-view · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
