项目作者: GottliebGlob

项目描述 :
Set of authentication inputs for React Native including name, email, phone number and show/hide password.
高级语言: JavaScript
项目地址: git://github.com/GottliebGlob/AuthInput.git
创建时间: 2021-05-26T17:40:06Z
项目社区:https://github.com/GottliebGlob/AuthInput

开源协议:

下载


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.

  1. npm i auth-input

Usage

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

  1. import React, {useState} from 'react';
  2. import { Text, View } from 'react-native';
  3. import AuthInput from 'auth-input'
  4. export default function App() {
  5. const [email, setEmail] = useState('')
  6. const [password, setPassword] = useState('')
  7. const emailHandler = (text) => {
  8. setEmail(text)
  9. }
  10. const passwordHandler = (text) => {
  11. setPassword(text)
  12. }
  13. return (
  14. <AuthInput
  15. type="email"
  16. label="E-Mail"
  17. keyboardType="email-address"
  18. minLength={5}
  19. maxLength={35}
  20. autoCapitalize="none"
  21. errorText="Please, use a valid e-mail."
  22. onInputChange={emailHandler}
  23. value={email}
  24. ></AuthInput>
  25. <AuthInput
  26. type="password"
  27. label="Password"
  28. keyboardType="default"
  29. minLength={5}
  30. maxLength={15}
  31. autoCapitalize="none"
  32. errorText="Please, use a valid password."
  33. onInputChange={passwordHandler}
  34. value={password}
  35. ></AuthInput>
  36. </View>
  37. );
  38. }

Properties

Prop Type Description Default Optional
type string Type of input (“email”, “phone”, “name” or “password”) - no
label string Text above the input - no
keyboardType string Default Ract Native TextInput keyboard types default yes
minLength number lower bound of text length - yes
maxLength number Upper limit of text length - yes
errorText string Text that appears when the user has entered incorrect data - no
onInputChange function Input handler function - no
value string Input state - no
borderColor string Bottom border color black yes
errorTextColor string Error color red yes
textColor string Text color black yes
labelColor string Label above the input color textColor yes
labelColor number Label above the input font size 20 yes

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