Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-pay-password

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-pay-password

React Native的支付密码输入框

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-native-pay-password

仿支付宝支付密码输入框

Install

$ npm install react-native-pay-password --save

Usage

共导出4个组件,其中PasswordInputPasswordModal这两个组件已能满足大部分使用情况。需要定制化的时候请使用InputViewKeyboard两个组件搭配使用。

PasswordInput(基于InputView和Keyboard)
import { PasswordInput } from 'react-native-pay-password'

export default class App extends Component {

  state = { password: '' }

  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.text}>{this.state.password}</Text>
        <PasswordInput onDone={(data) => { this.setState({ password: data }) }} />
      </View>
    );
  }
}

QQ20170706-112715-HD.gif

属性说明类型默认值
onDone支付密码输入后的回调,(password)=>{}Function-
clear打开键盘时是否清空已输入booleantrue
length支付密码的长度number6
borderColor支付密码显示框的边框颜色string#C7C7C7
style支付密码显示框的样式ViewProperties-
textStyle支付密码圆点的样式TextProperties-
PasswordModal(基于InputView和Keyboard)

打开此modal请用refs调用内部show()方法

import { PasswordModal } from 'react-native-pay-password'

export default class App extends Component {

  state = { password: '' }

  onPress() {
    this.refs.modal.show();
  }

  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.text} onPress={() => { this.onPress() }}>点击打开支付密码modal</Text>
        <Text style={styles.text}>{this.state.password}</Text>
        <PasswordModal ref='modal' onDone={(data) => { this.setState({ password: data }) }} />
      </View>
    );
  }
}

QQ20170706-113555-HD.gif

属性说明类型默认值
onDone支付密码输入后的回调,(password)=>{}Function-
clear打开键盘时是否清空已输入booleantrue
backdrop打开modal页面是否显示遮罩层booleantrue
height打开modal页面的高度number400
titlemodal页面的标题string请输入支付密码
length支付密码的长度number6
borderColor支付密码显示框的边框颜色string#C7C7C7
style支付密码显示框的样式ViewProperties-
textStyle支付密码圆点的样式TextProperties-
InputView(支付密码显示框)
import { InputView } from 'react-native-pay-password';
属性说明类型默认值
length支付密码的长度number6
index当前输入的位置number-
borderColor支付密码显示框的边框颜色string#C7C7C7
style支付密码显示框的样式ViewProperties-
textStyle支付密码圆点的样式TextProperties-
Keyboard(支付密码键盘)
import { Keyboard } from 'react-native-pay-password';
属性说明类型默认值
onPress按下数字0~9的回调,(text)=>{}Function
onDelete按下删除键的回调,()=>{}Function-
rerender该组件是否重新渲染booleantrue

Keywords

FAQs

Package last updated on 06 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc