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

@agartha/react-native-confirmation-code-input

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agartha/react-native-confirmation-code-input

A react-native component to input confirmation code for both Android and IOS

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-native-confirmation-code-input

A react-native confirmation code input for both IOS and Android

Features

  • A user-friendly component for inputting confirmation code
  • Extended from component, so you can use its props
  • Built-in type of code input: underline, box, circle
  • Set position: center, left, right, full width
  • Set size and active color, inactive color
  • Easy to customize style, use base style from TextInput component
  • Check code on finish or return code for async checking
  • Clear code on fail
  • Use React Native ES6

Screenshots

underline-28082017 box-28082017 circle-28082017 full-28082017

Installation

npm install react-native-confirmation-code-input --save

Usage

Basic

Import this module:

import CodeInput from 'react-native-confirmation-code-input';

Use as a component and style it:


render() {
  return (
    <CodeInput
      ref="codeInputRef1"
      secureTextEntry
      className={'border-b'}
      space={5}
      size={30}
      inputPosition='left'
      onFulfill={(code) => this._onFulfill(code)}
    />
    
    <CodeInput
      ref="codeInputRef2"
      secureTextEntry
      compareWithCode='AsDW2'
      activeColor='rgba(49, 180, 4, 1)'
      inactiveColor='rgba(49, 180, 4, 1.3)'
      autoFocus={false}
      ignoreCase={true}
      inputPosition='center'
      size={50}
      onFulfill={(isValid) => this._onFinishCheckingCode1(isValid)}
      containerStyle={{ marginTop: 30 }}
      codeInputStyle={{ borderWidth: 1.5 }}
    />
    
    <CodeInput
      ref="codeInputRef2"
      keyboardType="numeric"
      codeLength={5}
      className='border-circle'
      compareWithCode='12345'
      autoFocus={false}
      codeInputStyle={{ fontWeight: '800' }}
      onFulfill={(isValid, code) => this._onFinishCheckingCode2(isValid, code)}
    />
  )
}

props

This component uses the same props as . Below are additional props for this component:

PropTypeDefaultDescription
codeLengthnumber5length of confirmation code -> number of cells
compareWithCodestringcode to compare. if null, onFulfill callback return inputted code to check later
inputPositionstringcenterposition of code input in its container: left, right, center, full-width
sizenumber40size of input cells
spacenumber8space between 2 cells
classNamestringborder-boxSome built-in classname: border-box, border-circle, border-b, border-b-t, border-l-r
cellBorderWidthnumber1.0width of cell borders
activeColorstringrgba(255, 255, 255, 1)color of cells when active
inactiveColorstringrgba(255, 255, 255, 0.2)color of cells when inactive
ignoreCasebooleanfalseignore case when checking code
autoFocusbooleantrueauto focus on code input
codeInputStylestyle objectcustom style for code input
containerStylestyle objectcustom style for code input container
onFulfillfunctioncallback function called when fulfilling code. If compareWithCode is null -> return (code) in callback, else return (isValid, code). Required

functions

clear input:

this.refs.refName.clear();
...
<CodeInput 
    ...
    ref="refName"
/>

Example

See EXAMPLE

git clone https://github.com/ttdung11t2/react-native-confirmation-code-input.git
cd react-native-confirmation-code-input/example
npm install
react-native run-ios / react-native run-android

License

react-native-confirmation-code-input is released under the MIT license. See LICENSE for details.

Any question or support will welcome.

Keywords

FAQs

Package last updated on 26 Feb 2018

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