0.1.8 • Published 3 months ago

react-native-animated-otp-input v0.1.8

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

React Native Animated Otp Input

@anhquan291/react-native-animated-otp-input is a tiny library which provides an elegant UI with smooth Animation for the end user to input one time passcode (OTP). It also handles the input suggestion on iOS when the OTP SMS is received.

iOSAndroid

Installation

You need to have already installed the following packages:

Open a Terminal in your project's folder and install the library using yarn:

yarn add react-native-animated-otp-input

or with npm:

npm install react-native-animated-otp-input

Usage

import React from 'react';
import { Alert, StyleSheet, View } from 'react-native';
import OtpInput from 'react-native-animated-otp-input';

const OTPInput = () => {
  return (
    <View style={styles.container}>
      <OtpInput
        otpCount={5}
        autoFocus={false}
        onCodeFilled={(code: string) => {
          Alert.alert('Notification', `OTP is ${code}`);
        }}
        onCodeChanged={(codes: string) => {
          console.log({ codes });
        }}
      />
    </View>
  );
}

Params

ParameterrequiredDescription
pinCountYESNumber of digits in the component, maxium is 6
containerStyleNOThe style of the input field container
inputStyleNOThe style of the input field
focusColorNOThe color the input field which is focused
autoFocusNOAuto activate the input and bring up the keyboard when component is loaded
onCodeChangedNOCallback when the digits are changed
onCodeFilledNOCallback when the last digit is entered
editableNOSet editable for inputs
restNOThe other text input props
enteringAnimatedNOThe entering animation using reanimated layout
exitingAnimatedNOThe exiting animation using reanimated layout
restNOThe other text input props

Roadmap

  • Add unit tests
  • Add auto fill otp on Android

Contributing

If you’d like to contribute, I encourage you to fork this repository and improve it for the community.

License

MIT


Made with create-react-native-library

0.1.8

3 months ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago