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-password-strength-checker-fixed

v1.0.13

Published

A react-native password input with strength checker for both IOS and Android. Fixed for React Native v0.59

Downloads

15

Readme

react-native-password-strength-checker

A react-native password input with strength checker for both IOS and Android

Features

  • Use zxcvbn to check password strength, combine with custom rules and password length
  • Support for both IOS and Android, use ES6 React native
  • Animated strength bar
  • Check password is too short
  • Check password not match rules
  • Custom strength level (corresponding to 5 levels)
  • Custom style for password input and password strength

Dependencies

This Component is built using Dropbox zxcvbn password strength estimator library

Screenshots

2017-08-22 12_19_00

Installation

npm install react-native-password-strength-checker --save

Usage

Basic

Import this module:

import PasswordStrengthChecker from 'react-native-password-strength-checker';

Use as a component:

// Define streng level list
const strengLevels = [
      {
        label: 'Weak',
        labelColor: '#fff',
        widthPercent: '33',
        innerBarColor: '#fe6c6c'
      },
      {
        label: 'Weak',
        labelColor: '#fff',
        widthPercent: '33',
        innerBarColor: '#fe6c6c'
      },
      {
        label: 'Fair',
        labelColor: '#fff',
        widthPercent: '67',
        innerBarColor: '#feb466'
      },
      {
        label: 'Fair',
        labelColor: '#fff',
        widthPercent: '67',
        innerBarColor: '#feb466'
      },
      {
        label: 'Strong',
        labelColor: '#fff',
        widthPercent: '100',
        innerBarColor: '#6cfeb5'
      }
];

// Define too short object
const tooShort = {
      enabled: true,
      label: 'Too short',
      labelColor: 'red'
};

render() {
  return (
    ...
    <PasswordStrength
        secureTextEntry
        minLength={4}
        ruleNames="symbols|words"
        strengthLevels={strengthLevels}
        tooShort={tooShort}
        minLevel={0}
        barWidthPercent={65}
        showBarOnEmpty={true}
        barColor="#ccc"
        onChangeText={(text, isValid) => this.setState({ password: { value: text, isValid: isValid } })} 
    />
  )
}

Customization

  • Define min length for password.
    Default: 0
  • Rules: digits, letters, words, symbols, upperCase, lowerCase.
    Separate rules with |.
    Default: { ruleNames: 'lowerCase|upperCase|digits|symbols' }
  • Define min level to pass validation (0,1,2,3,4)
    Default: { minLevel: 2}
  • Define and enable too short case:
    Default: { tooShort: { enabled: false, labelColor: '#fff', label: 'Too short', widthPercent: '33', innerBarColor: '#fe6c6c' } }
    If you want to show 'too short', Enable it to show when password length is too short
  • Define strength labels and label colors, strength bar colors, percentage of width for each level
    Default: { strengthLevels: [ { label: 'Weak', labelColor: '#fff', widthPercent: '33', innerBarColor: '#fe6c6c' }, { label: 'Weak', labelColor: '#fff', widthPercent: '33', innerBarColor: '#fe6c6c' }, { label: 'Fair', labelColor: '#fff', widthPercent: '67', innerBarColor: '#feb466' }, { label: 'Fair', labelColor: '#fff', widthPercent: '67', innerBarColor: '#feb466' }, { label: 'Strong', labelColor: '#fff', widthPercent: '100', innerBarColor: '#6cfeb5' } ] }

Properties

This component uses the same props as . Below are additional props for this component:

Prop | Type | Optional | Defaul | Description ----------- | ------- | -------- | ------- | ----------------------- minLength | number | Yes | 0 | Min length for password ruleNames | string | Yes | Above | List of rule name to check password strengLevels | object array | Yes | Above | List of password strength level with label, label color, percentage of width, bar color tooShort | object | Yes | Above | enabled, label, label color, percentage of width, bar color for too short minLevel | number | Yes | 2 | Min level to pass password validation inputWraperStyle | object | Yes | | Style for wrapped password input inputStyle | object/style | Yes | | Style for password input strengthWrapperStyle | object/style | Yes | | Style for wrapped password strength bar and description strengthBarStyle | object/style | Yes | | Style for password strength bar innerStrengthBarStyle | object/style | Yes | | Style for password strength bar based on strength level strengthDescriptionStyle | object/style | Yes | | Style for password strength description barColor | string | Yes | '#ffffff' | Color of filled password strength bar barWidthPercent | number | Yes | 70 | Percentage of password strength bar width onChangeText | function | No | | Trigger when user inputs and password input finishes validation. Returns value and validation result showBarOnEmpty | boolean | Yes | true | Only show strength bar when input is empty or not

Strength level object:

Property | Type | Description ---------------- | --------- | ------------------------------------ label | string | Label for strength level description labelColor | string | Color for strength level description label widthPercent | number | Percentage of width for inner strength level bar innerBarColor | string | Color for inner strength level bar

Too short object:

Property | Type | Description ---------------- | ---------- | ----------------------------------- enabled | boolean | Enable too short description label | string | Label for strength level description labelColor | string | Color for strength level description label widthPercent | number | Percentage of width for inner strength level bar innerBarColor | string | Color for inner strength level bar

Example

See EXAMPLE

git clone https://github.com/ttdung11t2/react-native-password-strength-checker.git
cd react-native-password-strength-checker/example
npm install
react-native run-ios / react-native run-android

License

react-native-password-strength-checker is released under the MIT license. See LICENSE for details.

Any question or support will welcome.