# sx-react-keyboard

> password keyboard

Latest version **0.1.6** (published 2023-09-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install sx-react-keyboard
pnpm add sx-react-keyboard
yarn add sx-react-keyboard
bun add sx-react-keyboard
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2023-09-05 |
| First published | 2023-09-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 442.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | fang_yp@suixingpay.com |
| Maintainers | fangyp |
| Keywords | keyboard, password |

## Links

- npm: https://www.npmjs.com/package/sx-react-keyboard
- Repository: https://github.com/fangyp/sx-react-keyboard
- Homepage: https://github.com/fangyp/sx-react-keyboard#readme
- Issues: https://github.com/fangyp/sx-react-keyboard/issues
- npm.io page: https://npm.io/package/sx-react-keyboard

## Dependencies (2)

- [crypto-js](https://npm.io/package/crypto-js.md) ^4.1.1
- [jsencrypt](https://npm.io/package/jsencrypt.md) ^3.3.2

## Recent versions

- 0.1.6 (latest) — 2023-09-05
- 0.1.5 — 2023-09-05
- 0.1.4 — 2023-09-04
- 0.1.3 — 2023-09-04
- 0.1.2 — 2023-09-01
- 0.1.1 — 2023-09-01
- 0.1.0 — 2023-09-01

## README

# sx-react-keyboard

React 手机 H5 密码键盘

## install

```
yarn add sx-react-keyboard
or
npm i sx-react-keyboard
```

#### 引入插件

```javascript
import React, { useRef } from 'react';
import Keyboard from 'sx-react-keyboard';
```

#### 基本用法

```javascript
const keyboardRef = useRef(null);
// 打开键盘
keyboardRef.current.show();
// 关闭键盘
keyboardRef.current.hide();

<Keyboard
ref={keyboardRef}
type="letter"
length={6}
encrypt="md5"
publicKey=""
privateKey=""
onFinish={value => {
	console.log('密码是', value);
}}
/>
```

### API

| 参数       | 说明                                                       | 类型   | 默认值 |
| ---------- | :--------------------------------------------------------- | :----- | :----: |
| type       | 键盘类型，num: 纯数字键盘； letter: 数字、字母、字符键盘； | String |  num   |
| length     | 密码的位数，4 位密码 6 位密码 18 位以内的密码              | Number |   6    |
| ref        | 获取当前实例                                               | ref    |   -    |
| encrypt    | 加密方式，ras、md5 加密方式, ras 时必须传公钥 publicKey    | String |        |
| publicKey  | 公钥，encrypt="rsa"时必传                                  | String |        |
| privateKey | 私钥，公钥加密后使用 privateKey 私钥解密（测试加密用）     | String |        |

### Event

| 事件名   | 说明                 | 参数 |
| :------- | :------------------- | :--- |
| onFinish | 密码输入完成后的回调 | -    |


![alt 属性文本](https://beunc.oss-cn-beijing.aliyuncs.com/github/demo.png)

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