# react-signature-phone

> 移动端react的canvas签名

Latest version **1.0.1** (published 2019-04-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-signature-phone
pnpm add react-signature-phone
yarn add react-signature-phone
bun add react-signature-phone
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-04-30 |
| First published | 2019-04-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 142.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | 李家其 |
| Maintainers | xianzou77 |
| Keywords | react, react-component, signature, form, ui, canvas, 电子签名 |

## Links

- npm: https://www.npmjs.com/package/react-signature-phone
- Repository: https://github.com/xianzou/react-signature-phone
- Homepage: https://github.com/xianzou/react-signature-phone#readme
- Issues: https://github.com/xianzou/react-signature-phone/issues
- npm.io page: https://npm.io/package/react-signature-phone

## 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.1 (latest) — 2019-04-30
- 1.0.0 — 2019-04-30
- 0.0.6 — 2019-04-30

## README

[![npm package](https://img.shields.io/badge/npm-0.0.6-orange.svg?style=flat-square)](https://www.npmjs.com/package/react-signature-pad)



# React Signature phone
### forked 项目 react-signature-pad

- react版本的移动端电子签名
- 修改源码去除canvas缩放,自适应手机宽度
- 添加自定义 height（默认值200） 和width (默认值window.innerWidth)
- 原项目地址[react-signature-pad](https://github.com/blackjk3/react-signature-pad)

## 安装

```bash
$ yarn add react-signature-phone
or
$ npm install react-signature-phone
```



# 使用方式

```javascript
import React from 'react';
import SignaturePad from 'react-signature-pad';

React.render(
  <SignaturePad clearButton="true" width={300} height={150} />,
  document.body
)
```

# 方法

```javascript
<SignaturePad clearButton="true" ref="mySignature" />
...

var signature = this.refs.mySignature;

// Methods

// ===============================================
// isEmpty() - returns boolean
// ===============================================

signature.isEmpty();

// ===============================================
// clear() - clears canvas
// ===============================================

signature.clear();

// ===============================================
// toDataURL() - 将canvas转化成base64图
// ===============================================

signature.toDataURL();

// ===============================================
// fromDataURL() - 将base64图写入canvas
// ===============================================

signature.fromDataURL(base64String);

```

# CSS
一般不需要样式，如果需要样式点击这里： [this file](style.css),

# Example
```bash
$ yarn start
```
打开浏览器访问http://localhost:8080/

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