Giter VIP home page Giter VIP logo

react-native-otp-inputs's Introduction

react-native-otp-inputs

Demo

Demo

Description

react-native-otp-inputs is fully customizable, pure JavaScript package, that provides solution for One-time password feature with user friendly events like moving to previous input with backspace or going to next when filled in. It supports pasting and otp code into inputs

Supported version of React Native >= 0.53.0

It's because of onKeyPress event implementation on android.

Basic usage

import React, { Component } from 'react'
import { View } from 'react-native'
import OtpInputs from 'react-native-otp-inputs'

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <OtpInputs handleChange={code => console.log(code)} numberOfInputs={6} />
      </View>
    )
  }
}

API

Method Type Required Default Description
autoCapitalize string false 'none' Defines input auto capitalization (only use with keyboardType)
clearTextOnFocus boolean false false Defines if input text should be cleared on focus
containerStyles style (object) false none Styles applied to whole container
errorMessage string false none Error message that is displayed above inputs
errorMessageContainerStyles style (object) false none Styles applied to error message container
errorMessageTextStyles style (object) false none Styles applied to error message text
focusedBorderColor string false #0000ff borderColor of input when focused
handleChange function true console.log Returns otp code which is typed in inputs
inputContainerStyles style (object) false none Styles applied to each input container
inputsContainerStyles style (object) false none Styles applied to inputs container
inputTextErrorColor string false #ff0000 Color of text inside input container when error is passed in
keyboardType string true 'phone-pad' Keyboard type for inputs
numberOfInputs number true (1..6) 4 How many inputs should be rendered
secureTextEntry boolean false false Defines if input will hide text inside
selectTextOnFocus boolean false true Defines if input text should be selected on focus
unfocusedBorderColor string false transparent borderColor of input when not focused

Contributions

Great thanks to @kantorm.

Licence MIT

react-native-otp-inputs's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.