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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-otp-ultimate

v1.0.22

Published

TypeSafe Textview usable for OTP implementation

Downloads

366

Readme

ADDED OPTION TO AUTOCOMPLET ON IOS AND ANDROID, BY THE WAY inputCellLength is limited for the moment

REACT NATIVE OTP ULTIMATE


React Native Component that can used for OTPs and Pins as secure pin input.

npm version npm downloads

Installation


NPM

npm i -S react-native-otp-textinput

YARN

yarn add react-native-otp-textinput

Demo


How to Use


Check the Example react native app for usage.

Platform Support


Supports both Android and iOS.

Props


The following props are applicable for the component along with props supported by react native TextInput component

| Prop | Type | Optional | Default | Description | | ---------------- | ------ | -------- | ------------ | -------------------------------------------------------------------------------- | | defaultValue | string | Yes | '' | Default Value that can be set based on OTP / Pin received from parent container. | | handleTextChange | func | Yes | n/a | callback with concated string of all cells as argument. | onCodeFilled | func | Yes | n/a | when code is filled function returns the code so you can perform actions. | inputCount | number | Yes | 4 | Number of Text Input Cells to be present. | | tintColor | string | Yes | #3CB371 | Color for Cell Border on being focused. | | offTintColor | string | Yes | #DCDCDC | Color for Cell Border Border not focused. | | inputCellLength | number | Yes | 1 | Number of character that can be entered inside a single cell. | | containerStyle | object | Yes | {} | style for overall container. | | textInputStyle | object | Yes | {} | style for text input. | | testIDPrefix | string | Yes | 'otpinput' | testID prefix, the result will be otp_input_0 until inputCount | autoFillFromClipBoard | boolean | Yes | true | if should auto fill from clipboard on android

Helper Functions


Clearing and Setting values to component

// using traditional ref
clearText = () => {
    this.otpInput.clear();
}

setText = () => {
    this.otpInput.setValue("1234");
}

render() {
    return (
        <View>
            <OTPTextInput ref={e => (this.otpInput = e)} >
            <Button title="clear" onClick={this.clearText}>
        </View>
    );
}
// hooks
import React, { useRef } from 'react';

const ParentComponent = () => {
    const otpInput = useRef(null);

    const clearText = () => {
        otpInput.current.clear();
    }

    const setText = () => {
        otpInput.current.setValue("1234");
    }

    return (
        <View>
            <OTPTextInput ref={e => (otpInput = e)} >
            <Button title="clear" onClick={clearText}>
        </View> ̰
    );
}