1.0.3 • Published 4 years ago

react-native-custom-pin-code v1.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

React Native Custom Pin Code

Simple realization with some custom styles (left element, right element near the zero button and some bottom button, for example 'Exit'), complete/clear callback, etc.

a simple example

Installation

$ npm install --save react-native-custom-pin-code

Usage

import { CustomPincode } from 'react-native-custom-pin-code';

All parameters are optional.

Basic Usage

<CustomPincode
  completeCallback={(inputtedPin, callbackClear) => {
   if (inputtedPin === actualPin) {
    return goToFinish() 
  }
  
  // If you want clear your pincode data
  callbackClear()
 }}
/>

Props

PropTypeDefaultDescriptionRequired
completeCallbackfunction() => {}Callback is triggered when your pinLength === number of clicks buttons from 0 to 9 (or when all points are active :D) first argument - your pin code, second argument - method to clear points and state this lib (pin values)No
pinLengthnumber4Pin length your pin code (default 4). Buttons (0...9) pressed length === Pin length, then completeCallbackNo
pointsLengthnumber4Points length (default 4). If this prop is not passed, then points have length from pinLength propNo
pointsStyleobject{}Styles for points containerNo
pointStyleobject{}Styles for pointNo
pointActiveStyleobject{}Styles for active pointsNo
keyPointsstringpin-buttonsKey for map array of points (0...pointsLength) for some casesNo
isPinErrorbooleanfalseResponsible for displaying error points stylesNo
errorPointStylesobject{}Styles for every point with isPinError (true) propNo
leftElementelementnullJSX left element in the last rowNo
leftElementCallbackfunction() => {}Callback for left elementNo
isLeftbooleanfalseResponsible for displaying left elementNo
leftButtonStyleobject{}Styles for left buttonNo
leftContainerStyleobject{}Styles for left containerNo
rightElementelementnullJSX right element in the last rowNo
rightElementCallbackfunction() => {}Callback for right elementNo
rightContainerStyleobject{}Styles for right containerNo
isRightbooleanfalseResponsible for displaying right elementNo
rightButtonStyleobject{}Styles for right buttonNo
bottomElementelementnullJSX bottom elementNo
bottomCallbackobject{}Styles for bottom buttonNo
bottomElementStyleobject{}Styles for bottom buttonNo
isBottombooleanfalseResponsible for displaying bottom elementNo
pinButtonStyleobject{}Styles for buttons (pins) 0...9 buttonsNo
isDeleteButtonbooleanfalseResponsible for displaying delete button (Priority higher than isLeft or isRight props)No
buttonDeleteElementelementnullJSX button delete element in the last rowNo
buttonDeletePositionstringnullPosition delete button in the last rowNo
pinContainerStylesobject{}Styles for pin code container without bottom elementNo
containerStylesobject{}Styles for pin code container with bottom element (Higher than pin code container styles)No
zeroButtonStyleobject{}Styles for the zero (0) buttonNo
keyButtonsstringpin-buttonsKey for map array of buttons (0...9) for some casesNo

Built With

License

This project is licensed under the MIT License - see the LICENSE.md file for details