1.0.2 • Published 2 years ago
@usarov/react-native-otp-inputs v1.0.2
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
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.