1.2.21 • Published 4 years ago
react-vitual-keyboard v1.2.21
react-vitual-keyboard
For mobile captcha virtual keyboard, using HTML5 instead of native development
Install
npm install react-vitual-keyboard --save
Usage
import React from 'react';
import CodeInput from 'react-vitual-keyboard';
import styles from './index.scss';
interface IProps {
}
interface IState {
show: boolean;
}
const rightCode = [8, 8, 8, 8];
class App extends React.Component<IProps, IState> {
constructor(props: IProps) {
super(props);
this.state = { show: false };
}
public handleInput(numbers: number[]) {
console.log('The user is typing', numbers);
}
public handleFinish(numbers: number[]) {
console.log('User input completed', numbers);
}
public handleSendCode() {
console.log('User click please send verification code');
return false; // If the captcha is successfully obtained return true
}
public render() {
return (
<div>
<div className={styles.btn} onClick={() => this.setState({show: true})}>open</div>
<CodeInput
num={4} // required (Number of number boxes)[number]
mobile='13767676767'
show={this.state.show} // required (Close and hide)[boolean]
onClose={ // required (Closed callback)[function]
(show: boolean) => this.setState({show})
}
onInput={this.handleInput} // optional (The callback being entered)[function]
onFinish={this.handleFinish} // optional (Enter the completed callback)[function]
onSendCode={this.handleSendCode} // optional (Send verification code)[function]
onValidation = (nubmers) => Promise.resolve('ok') // The captcha is entered correctly
/>
</div>
);
}
}
export default App;
Development
You can download the source code and modify it yourself from github react-vitual-keyboard
npm install
npm run serve
npm run build
1.2.21
4 years ago
1.2.20
4 years ago
1.2.19
4 years ago
1.2.18
4 years ago
1.2.16
4 years ago
1.2.17
4 years ago
1.2.15
4 years ago
1.2.13
4 years ago
1.2.14
4 years ago
1.2.12
4 years ago
1.2.10
4 years ago
1.2.11
4 years ago
1.2.8
4 years ago
1.2.9
4 years ago
1.2.7
4 years ago
1.2.6
4 years ago
1.2.5
4 years ago
1.2.3
4 years ago
1.2.2
4 years ago
1.2.1
4 years ago
1.2.0
4 years ago
1.1.9
4 years ago
1.1.7
4 years ago
1.1.6
4 years ago
1.1.4
4 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.1.3
4 years ago
1.1.2
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.2
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago