npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rn-otp-view

v1.0.2

Published

A customizable OTP input component for React Native

Readme

rn-otp-view

A customizable and easy-to-use OTP (One-Time Password) input component for React Native.

Features

  • ✅ Fully customizable styling
  • ✅ TypeScript support
  • ✅ Auto-focus on next input
  • ✅ Backspace handling
  • ✅ iOS & Android support
  • ✅ Keyboard dismissal
  • ✅ Configurable length
  • ✅ Secure text entry option
  • ✅ Zero dependencies
  • ✅ Lightweight

Installation

npm install rn-otp-view

or

yarn add rn-otp-view

Usage

Basic Example

import React from "react";
import { View, Alert } from "react-native";
import OTPInput from "rn-otp-view";

const App = () => {
  const handleComplete = (code: string) => {
    console.log("OTP Entered:", code);
    // Verify OTP here
  };

  return (
    <View style={{ flex: 1, justifyContent: "center", padding: 20 }}>
      <OTPInput
        length={6}
        onComplete={handleComplete}
        focusBorderColor="#28AF60"
        defaultBorderColor="#E0E0E0"
      />
    </View>
  );
};

export default App;

With Custom Styling

<OTPInput
  length={4}
  onComplete={handleComplete}
  containerStyle={{
    gap: 15,
    paddingHorizontal: 20,
  }}
  boxStyle={{
    width: 60,
    height: 60,
    borderRadius: 10,
    backgroundColor: "#F5F5F5",
  }}
  inputStyle={{
    fontSize: 24,
    fontWeight: "700",
    color: "#333",
  }}
  focusBorderColor="#007AFF"
  defaultBorderColor="#CCCCCC"
/>

Secure PIN Entry

<OTPInput
  length={4}
  secureTextEntry={true}
  onComplete={handlePinComplete}
  focusBorderColor="#FF3B30"
/>

Props

| Prop | Type | Default | Description | | -------------------- | ------------------------ | ----------- | -------------------------------------- | | length | number | 6 | Number of OTP input boxes | | onComplete | (code: string) => void | undefined | Callback when all inputs are filled | | onChange | (code: string) => void | undefined | Callback on every input change | | containerStyle | ViewStyle | undefined | Style for the container | | inputStyle | TextStyle | undefined | Style for the input text | | boxStyle | ViewStyle | undefined | Style for each input box | | focusBorderColor | string | "#28AF60" | Border color when input is focused | | defaultBorderColor | string | "#E0E0E0" | Border color when input is not focused | | autoFocus | boolean | true | Auto-focus first input on mount | | secureTextEntry | boolean | false | Hide input characters (for PIN) |

Advanced Examples

With Form Validation

import React, { useState } from "react";
import { View, Text, StyleSheet } from "react-native";
import OTPInput from "rn-otp-view";

const OTPScreen = () => {
  const [otp, setOtp] = useState("");
  const [error, setError] = useState("");

  const handleChange = (code: string) => {
    setOtp(code);
    setError("");
  };

  const handleComplete = async (code: string) => {
    try {
      // Verify OTP with your backend
      const response = await verifyOTP(code);
      if (response.success) {
        // Navigate to next screen
      }
    } catch (err) {
      setError("Invalid OTP. Please try again.");
    }
  };

  return (
    <View style={styles.container}>
      <Text style={styles.title}>Enter Verification Code</Text>
      <OTPInput
        length={6}
        onChange={handleChange}
        onComplete={handleComplete}
      />
      {error ? <Text style={styles.error}>{error}</Text> : null}
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center",
    padding: 20,
  },
  title: {
    fontSize: 20,
    fontWeight: "bold",
    textAlign: "center",
    marginBottom: 30,
  },
  error: {
    color: "red",
    textAlign: "center",
    marginTop: 10,
  },
});

export default OTPScreen;

Platform Compatibility

  • ✅ iOS
  • ✅ Android
  • ✅ Expo
  • ✅ React Native CLI

Requirements

  • React Native >= 0.60
  • React >= 16.8

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Issues

If you encounter any issues, please report them here.

Author

Umang Thakkar - GitHub


Made with ❤️ for React Native developers