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

password-check-rn

v1.0.7

Published

A simple password strength indicator component

Downloads

54

Readme

password-check-rn

A simple password strength indicator component for react native

Installation

npm install password-check-rn

Usage

import { View, TextInput } from 'react-native';
import React, { useState } from 'react';
import { PasswordCheck } from 'password-check-rn';

export default function App() {
  const [password, setPassword] = useState<string>('');
  const inputRef = useRef<TextInput | null>(null);

  function isValid<T>(params: T) {
    // receives all rules as keys with values as boolean to indicate if condition is met
    console.log('params', params);
  }

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <View
        style={{
          width: 300,
          height: 40,
        }}
      >
        <TextInput
          ref={inputRef}
          value={password}
          onChangeText={setPassword}
          style={{
            borderWidth: 1,
            borderColor: 'lightGray',
            width: '100%',
            height: '100%',
          }}
        />
        <PasswordCheck
          value={password}
          inputRef={inputRef}
          position="top"
          images={{ pass: IMAGE, fail: IMAGE }}
          positionStyle={{ top: 40 }}
          rules={initialRules}
          containerStyle={{}}
          headerTextStyle={{}}
          topArrowStyle={{}}
          bottomArrowStyle={{}}
          rowContainerStyle={{}}
          rowImageStyle={{}}
          rowIconPassStyle={{}}
          rowIconFailStyle={{}}
          rowTextPassStyle={{}}
          rowTextFailStyle={{}}
          isValid={isValid}
        />
      </View>
    </View>
  );
}

Props

| name | required | type | | ----------------- | -------- | --------------------------- | | value | Yes | string | | inputRef | Yes | MutableRefObject | | position | No | 'top' or 'bottom' | | images | No | {pass:string,fail:string } | | positionStyle | No | ViewStyle | | containerStyle | No | ViewStyle | | headerTextStyle | No | TextStyle | | topArrowStyle | No | ViewStyle | | bottomArrowStyle | No | ViewStyle | | rowContainerStyle | No | ViewStyle | | rowImageStyle | No | ImageStyle | | rowIconPassStyle | No | TextStyle | | rowIconFailStyle | No | TextStyle | | rowTextPassStyle | No | TextStyle | | rowTextFailStyle | No | TextStyle |

rules prop type

if rules is passed, "notEmpty" key prop is required. All others are optional.

interface RulesProp {
  heading?: string; // takes message as value
  minLength?: [number, string]; // takes minimum required characters length at 0th index and message at index 1
  maxLength?: [number, string]; // takes maximum allowed characters length 0th index and message at index 1
  specialChar?: [RegExp, string]; // takes regular expression at 0th index and message at index 1
  match?: [string, string]; // for confirm password, takes previous password to match with current password at 0th index and message at index 1
  number?: string; // takes message as value
  smallLetter?: string; // takes message as value
  capitalLetter?: string; // takes message as value
  notEmpty: string; // takes message as value
}

License

MIT


Made with create-react-native-library