0.1.1 • Published 9 months ago

@skara-live/react-native-otp v0.1.1

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

react-native-otp

A React Native Otp input component.

Installation

npm install react-native-otp

Usage

import * as React from 'react';
import { StyleSheet, View } from 'react-native';
import OTPInput from 'react-native-otp';

export default function App() {
  const [code, setCode] = React.useState<string[]>([])

  return (
    <View style={styles.container}>
      <OTPInput length={6} value={code} onChange={(value) => setCode(value)} />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  box: {
    width: 60,
    height: 60,
    marginVertical: 20,
  },
});

Props

NameRequiredTypeDescription
lengthtruenumberThe number of input fields
valuetruestring[]The value from the inputs
onChangetrue(value:string[]) => voidCall function to run on input change
disabledoptionalbooleanToggle between editable state of the input
inputStyleoptionalViewStyleThe style object for the inputs
containerStyleoptionalViewStyleThe style object for the container

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

0.1.1

9 months ago

0.1.0

9 months ago