1.0.2 • Published 3 years ago

auth-input v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Auth Input

alt-текст

Auth Input is a React Native custom component, providing fields for entering name, password, phone number and email.

Installation

Install the package with NPM.

npm i auth-input

Usage

Usage is very simple. Just add the component to your file.

import React, {useState} from 'react';
import { Text, View } from 'react-native';
import AuthInput from 'auth-input'

export default function App() {
    const [email, setEmail] = useState('')
    const [password, setPassword] = useState('')
   
    const emailHandler = (text) => {
        setEmail(text)
    }
    const passwordHandler = (text) => {
        setPassword(text)
    }

 
  return (
                        <AuthInput
                            type="email"
                            label="E-Mail"
                            keyboardType="email-address"
                            minLength={5}
                            maxLength={35}
                            autoCapitalize="none"
                            errorText="Please, use a valid e-mail."
                            onInputChange={emailHandler}
                            value={email}
                        />

                        <AuthInput
                            type="password"
                            label="Password"
                            keyboardType="default"
                            minLength={5}
                            maxLength={15}
                            autoCapitalize="none"
                            errorText="Please, use a valid password."
                            onInputChange={passwordHandler}
                            value={password}
                        />
    </View>
  );
}

Properties

PropTypeDescriptionDefaultOptional
typestringType of input ("email", "phone", "name" or "password")-no
labelstringText above the input-no
keyboardTypestringDefault Ract Native TextInput keyboard typesdefaultyes
minLengthnumberlower bound of text length-yes
maxLengthnumberUpper limit of text length-yes
errorTextstringText that appears when the user has entered incorrect data-no
onInputChangefunctionInput handler function-no
valuestringInput state-no
borderColorstringBottom border colorblackyes
errorTextColorstringError colorredyes
textColorstringText colorblackyes
labelColorstringLabel above the input colortextColoryes
labelColornumberLabel above the input font size20yes

You can use properties of TextInput.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT