Skip to content

lotosbin/react-native-pin-input-sample

Repository files navigation

react-native-pin-input-sample

A sample for react-native-pin-input

Installation

npm install --save react-native-pin-input

or

yarn add react-native-pin-input

Sample

set keyboardType

        <PinInput
              ref={"pin"}
              pinLength={6}
              value={'654321'}
              autoFocus={false}
              pinItemStyle={{width: 50, height: 50}}
              pinItemProps={{keyboardType:'number-pad'}}
              onPinCompleted={(pin) => {
                  this.setState({pin: pin})
              }}
          />

method

  • setPin
this.refs.pin.setPin('123456')
  • getPin
const pin = this.refs.pin.getPin()
  • clearPin
this.refs.pin.clearPin()
  • focusPin(i)
this.refs.pin.focusPin(0)