Skip to content

Commit

Permalink
docs: add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SectionTN committed Mar 21, 2024
1 parent 96b1a3d commit 9aea043
Showing 1 changed file with 48 additions and 6 deletions.
54 changes: 48 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,65 @@
# @sectiontn/otp-input
# OTP Text Input

An elegant and highly customizable One-Time Password (OTP) input library designed to simplify the implementation and enhance the user experience of OTP authentication flows in React Native Applications.

* Written in TypeScript.
* Supports Android / iOS / Web.
* Highly customizable.
* Easy to use.
* Lightweight.
* Fully responsive.
* Supports RTL.
* Supports Dark Mode.
* Supports custom styles.
* Supports custom keyboard types.

## Installation

```sh
npm install @sectiontn/otp-input
```
OR
```sh
yarn add @sectiontn/otp-input
```

## Usage
## Imports

Import the `OTP` component from the `@sectiontn/otp-input` package and use it in your React Native application.

```typescript jsx
import { OTPTextInput } from '@sectiontn/otp-input';
```

You may need to import type `OTPTextViewHandle` to use the `ref` on the component.

```js
import { multiply } from '@sectiontn/otp-input';
```typescript jsx
import { OTPTextInput, type OTPTextViewHandle } from '@sectiontn/otp-input';
```
## Usage
Call the `OTPTextInput` component in your JSX code and pass the required props to customize the OTP input field.

// ...
```typescript jsx
import { Platform } from 'react-native';

const result = await multiply(3, 7);
<OTPTextInput
inputCount={4}
tintColor={"#FF6F61"}
offTintColor={"#BBBCBE"}
onTextChangeHandler={(pin: string) => {
console.log('Current OTP:', pin);
}}
keyboardType={Platform.OS === 'ios' ? 'number-pad' : 'numeric'}
/>
```

## Example

Full Example: Check the example at [OTP Input Example](https://github.com/SectionTN/otp-input-example) made with react-native-cli.
<br>
<br>
Advanced Usage: [Expo Snack Demo](https://snack.expo.dev/@sectiontn/otptextinput-advanced-example)

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
Expand Down

0 comments on commit 9aea043

Please sign in to comment.