Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: enhance README #48

Merged
merged 5 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.DS_Store
coverage
coverage
dist
10 changes: 7 additions & 3 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![npm version](https://badge.fury.io/js/react-native-otp-entry.svg?&kill_cache=1)](https://badge.fury.io/js/react-native-otp-entry)
[![npm](https://img.shields.io/npm/dm/react-native-otp-entry.svg?&kill_cache=1)]()
[![install size](https://packagephobia.com/badge?p=react-native-otp-entry)](https://packagephobia.com/result?p=react-native-otp-entry)
[![cov](https://anday013.github.io/react-native-otp-entry/badges/coverage.svg?&kill_cache=1)](https://github.com/anday013/react-native-otp-entry/actions)
[![License](https://img.shields.io/badge/license-MIT-blue.svg?&kill_cache=1)](https://github.com/your-username/react-native-otp-entry/blob/main/LICENSE)

Expand Down Expand Up @@ -62,9 +63,11 @@ yarn add react-native-otp-entry
focusStickBlinkingDuration={500}
onTextChange={(text) => console.log(text)}
onFilled={(text) => console.log(`OTP is ${text}`)}
textInputProps={{
accessibilityLabel: "One-Time Password",
}}
theme={{
containerStyle: styles.container,
inputsContainerStyle: styles.inputsContainer,
pinCodeContainerStyle: styles.pinCodeContainer,
pinCodeTextStyle: styles.pinCodeText,
focusStickStyle: styles.focusStick,
Expand All @@ -80,6 +83,7 @@ The `react-native-otp-entry` component accepts the following props:
| Prop | Type | Description |
| ---------------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------- |
| `numberOfDigits` | number | The number of digits to be displayed in the OTP entry. |
| `textInputProps` | TextInputProps | Extra props passed to underlying hidden TextInput (see: https://reactnative.dev/docs/textinput) |
| `autoFocus` | boolean | Default: true. Set autofocus. |
| `focusColor` | ColorValue | The color of the input field border and stick when it is focused. |
| `onTextChange` | (text: string) => void | A callback function is invoked when the OTP text changes. It receives the updated text as an argument. |
Expand All @@ -88,12 +92,10 @@ The `react-native-otp-entry` component accepts the following props:
| `theme` | Theme | Custom styles for each element. |
| `focusStickBlinkingDuration` | number | The duration (in milliseconds) for the focus stick to blink. |
| `disabled` | boolean | Default: false. Disable the input |
| `textInputProps` | TextInputProps | Extra props passed to underlying hidden TextInput (see: https://reactnative.dev/docs/textinput) |

| Theme | Type | Description |
| ------------------------------- | --------- | ---------------------------------------------------------------------------------- |
| `containerStyle` | ViewStyle | Custom styles for the root `View`. |
| `inputsContainerStyle` | ViewStyle | Custom styles for the container that holds the input fields. |
| `pinCodeContainerStyle` | ViewStyle | Custom styles for the container that wraps each individual digit in the OTP entry. |
| `pinCodeTextStyle` | TextStyle | Custom styles for the text within each individual digit in the OTP entry. |
| `focusStickStyle` | ViewStyle | Custom styles for the focus stick, which indicates the focused input field. |
Expand All @@ -103,6 +105,8 @@ The `react-native-otp-entry` component accepts the following props:

Note: The `ViewStyle` and `TextStyle` types are imported from `react-native` and represent the style objects used in React Native for views and text, respectively.

![Theme](otp.drawio.svg)

## Ref

The `react-native-otp-entry` component exposes these functions with `ref`:
Expand Down
3 changes: 0 additions & 3 deletions dist/jest.config.d.ts

This file was deleted.

21 changes: 0 additions & 21 deletions dist/jest.config.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/jest.setupFilesAfterEnv.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions dist/jest.setupFilesAfterEnv.js

This file was deleted.

3 changes: 0 additions & 3 deletions dist/src/OtpInput/OtpInput.d.ts

This file was deleted.

46 changes: 0 additions & 46 deletions dist/src/OtpInput/OtpInput.js

This file was deleted.

35 changes: 0 additions & 35 deletions dist/src/OtpInput/OtpInput.styles.d.ts

This file was deleted.

35 changes: 0 additions & 35 deletions dist/src/OtpInput/OtpInput.styles.js

This file was deleted.

29 changes: 0 additions & 29 deletions dist/src/OtpInput/OtpInput.types.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions dist/src/OtpInput/OtpInput.types.js

This file was deleted.

9 changes: 0 additions & 9 deletions dist/src/OtpInput/VerticalStick.d.ts

This file was deleted.

28 changes: 0 additions & 28 deletions dist/src/OtpInput/VerticalStick.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/src/OtpInput/__tests__/OtpInput.test.d.ts

This file was deleted.

Loading
Loading