@usarov/react-native-otp-inputs

1.0.2 • Public • Published

Expo is currently not supported as Clipboard is not included in Expo SDK

$ yarn add @usarov/react-native-otp-inputs @react-native-clipboard/clipboard

After installation run:

$ npx pod-install

Clipboard module has been extracted from react-native core, so it needs to be installed separately. Package uses it for autofill feature

For React Native version 0.59

React Native <= 0.59

run the following command to link the package:

$ react-native link @react-native-clipboard/clipboard

For iOS, make sure you install the pod file.

cd ios && pod install && cd ..

Basic usage

import React, { useState } from 'react';
import { View } from 'react-native';
import OtpInputs from '@usarov/react-native-otp-inputs';

export const App = () => {
const [code, setCode] = useState('');

    return (
      <View flex={1}>
        <OtpInputs
          defaultValue={code}
          autoFocus
          handleChange={setCode}
          inputStyles={{ textAlign: 'center' }}
          numberOfInputs={4}
        />
      </View>
    );
}

API

Contributors

Great thanks to : @usarov.

Package Sidebar

Install

npm i @usarov/react-native-otp-inputs

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

28.8 kB

Total Files

11

Last publish

Collaborators

  • usarov