All Projects → Spikef → React Native Gesture Password

Spikef / React Native Gesture Password

Licence: mit
A gesture password component for React Native. It supports both iOS and Android since it's written in pure JavaScript.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Gesture Password

interval
This PHP library provides some tools to handle intervals. For instance, you can compute the union or intersection of two intervals.
Stars: ✭ 25 (-95.28%)
Mutual labels:  interval
audio-context-timers
A replacement for setInterval() and setTimeout() which works in unfocused windows.
Stars: ✭ 12 (-97.74%)
Mutual labels:  interval
Time4j
Advanced date, time and interval library for Java with sun/moon-astronomy and calendars like Chinese, Coptic, Ethiopian, French Republican, Hebrew, Hijri, Historic Christian, Indian National, Japanese, Julian, Korean, Minguo, Persian, Thai, Vietnamese
Stars: ✭ 328 (-38.11%)
Mutual labels:  interval
irsync
rsync on interval, via command line binary or docker container. Server and IOT builds for pull or push based device content management.
Stars: ✭ 19 (-96.42%)
Mutual labels:  interval
dlock
Interval Lock
Stars: ✭ 19 (-96.42%)
Mutual labels:  interval
IntervalSets.jl
Interval Sets for Julia
Stars: ✭ 62 (-88.3%)
Mutual labels:  interval
rust-lapper
Rust implementation of a fast, easy, interval tree library nim-lapper
Stars: ✭ 39 (-92.64%)
Mutual labels:  interval
Tty Progressbar
Display a single or multiple progress bars in the terminal.
Stars: ✭ 377 (-28.87%)
Mutual labels:  interval
mahler.c
Western music theory library in C99
Stars: ✭ 13 (-97.55%)
Mutual labels:  interval
Musictheory
Universal music theory library for iOS, iPadOS, macOS, tvOS and watchOS in Swift
Stars: ✭ 262 (-50.57%)
Mutual labels:  interval
AdvancedTimer
AdvancedTimer implementation for Xamarin.Forms This repo is no longer maintained. New repo available.
Stars: ✭ 40 (-92.45%)
Mutual labels:  interval
candlestick-convert
[NPM] OHLCV Candlestick Batcher/Converter
Stars: ✭ 39 (-92.64%)
Mutual labels:  interval
cron-schedule
A zero-dependency cron parser and scheduler for Node.js, Deno and the browser.
Stars: ✭ 28 (-94.72%)
Mutual labels:  interval
MOTE
Magnitude of the Effect - An Effect Size and CI calculator
Stars: ✭ 17 (-96.79%)
Mutual labels:  interval
Net
Android上强大的网络请求
Stars: ✭ 344 (-35.09%)
Mutual labels:  interval
chronoman
Utility class to simplify use of timers created by setTimeout
Stars: ✭ 15 (-97.17%)
Mutual labels:  interval
UniRate
Unity plugin to easily manage the application frame rate and rendering interval. Preventing battery power consumption and device heat, especially on mobile platforms.
Stars: ✭ 26 (-95.09%)
Mutual labels:  interval
Pg timetable
pg_timetable: Advanced scheduling for PostgreSQL
Stars: ✭ 382 (-27.92%)
Mutual labels:  interval
Human Interval
Human readable time distances for javascript
Stars: ✭ 360 (-32.08%)
Mutual labels:  interval
Portion
portion, a Python library providing data structure and operations for intervals.
Stars: ✭ 255 (-51.89%)
Mutual labels:  interval

react-native-gesture-password

A gesture password component for React Native (web). It supports both iOS, Android and Web since it's written in pure JavaScript.

一个React Native的手势密码组件,纯JavaScript实现,因此同时支持iOS、安卓和Web平台。

image

Install

npm install react-native-gesture-password --save
npm install prop-types    --save

Properties

All properties bellow are optional.

message (string)

The message text you want to show. NOTE: If you leave this blank, no message appears for any state changes.

status (string)

Can be 'normal', 'right' or 'wrong'.

The gesture password don't validate your password. You should do that yourself, and tell the result by status.

style (string)

Styles for the gesture password view.

textStyle (string)

Style for the text element in the view.

normalColor (string)

Use this color to render the default circle color.

rightColor (string)

Use this color to render when status !== 'wrong'.

wrongColor (string)

Use this color to render when status === 'wrong'.

transparentLine (boolean)

True for transparent line.

interval (number)

The active circles will be reset automatically after you give an interval.

allowCross (boolean)

Allow cross the circles(eg: 1 -> 7 -> 4), default is false.

onStart (function)

Event raised when user touch a number circle.

onEnd (function)

Event raised when user finish input a password.

onReset (function)

Event raised after the reset interval has cleared circles. Can be used to reset message.

children

Other components that you want to display.

outerCircle and innerCircle (boolean)

Control whether to draw outer and inner circle, true default.

Examples

var React = require('react');
var {
    AppRegistry,
    } = require('react-native');

var PasswordGesture = require('react-native-gesture-password');

var Password1 = '';
var AppDemo = React.createClass({
    // Example for check password
    onEnd: function(password) {
        if (password == '123') {
            this.setState({
                status: 'right',
                message: 'Password is right, success.'
            });

            // your codes to close this view
        } else {
            this.setState({
                status: 'wrong',
                message: 'Password is wrong, try again.'
            });
        }
    },
    onStart: function() {
        this.setState({
            status: 'normal',
            message: 'Please input your password.'
        });
    },
    onReset: function() {
        this.setState({
            status: 'normal',
            message: 'Please input your password (again).'
        });
    },
    // Example for set password
    /*
    onEnd: function(password) {
        if ( Password1 === '' ) {
            // The first password
            Password1 = password;
            this.setState({
                status: 'normal',
                message: 'Please input your password secondly.'
            });
        } else {
            // The second password
            if ( password === Password1 ) {
                this.setState({
                    status: 'right',
                    message: 'Your password is set to ' + password
                });

                Password1 = '';
                // your codes to close this view
            } else {
                this.setState({
                    status: 'wrong',
                    message:  'Not the same, try again.'
                });
            }
        }
    },
    onStart: function() {
        if ( Password1 === '') {
            this.setState({
                message: 'Please input your password.'
            });
        } else {
            this.setState({
                message: 'Please input your password secondly.'
            });
        }
    },
    */

    getInitialState: function() {
        return {
            message: 'Please input your password.',
            status: 'normal'
        }
    },
    render: function() {
        return (
            <PasswordGesture
                ref='pg'
                status={this.state.status}
                message={this.state.message}
                onStart={() => this.onStart()}
                onEnd={(password) => this.onEnd(password)}
                />
        );
    }
});

AppRegistry.registerComponent('AppDemo', () => AppDemo);

Change Logs

0.4.0

  • Prettier: best practices for Format documents
  • Performance: Increase performance by using React hooks
  • Declaration
  • Readme: this package work with react-native-web well

(@hosseinmd)

v0.2.0

Rewrite with ES6 for [email protected]+ support

Add outerCircle and innerCircle properties

v0.1.5

TextStyle and onReset event. (@caledhwa)

v0.1.4

Manage the adaptation to landscape orientation. (@jujumoz)

v0.1.3

Add the allowCross property.

v0.1.2

Improve the performance for real device.

v0.1.0

Rewrite in pure javascript, for Android support.

Notes

This old version(<0.1.0) is at the branch native. I won't update that unless fix bugs.

If you have suggestions or bug reports, feel free to send pull request or create new issue.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].