0.2.1 • Published 7 years ago

react-native-inputs v0.2.1

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

react-native-inputs

React native inputs for real world apps. Easy to setup, configure and use.

Screenshot

Installation

npm install react-native-inputs --save

or

yarn add react-native-inputs

Usage

import { TextInput, PasswordInput } from 'react-native-inputs'

TextInput

<TextInput
  onRef={r => { this.email = r }}
  value={email}
  editable={!this.props.fetching}
  valid={isEmail(email)}
  label='Email address'
  returnKeyType='next'
  borderBottomColor='#F70044'
  iconElement={<Icon size={20} name='at-sign' style={{ color: '#F70044'}} />}
  onChangeText={text => this.handleChange(text)}
  onSubmitEditing={() => this.password.focus()}
/>

TextInput props

PropsDefault valuesPossible values
label'Label text'any string
valuenoneany string
borderBottomColornoneany string
validfalseBoolean
validate'onBlur'enum 'onBlur', 'onChangeText'
editablefalseBoolean
iconElementnoneIcon element e.g react-native-vector-icons
errorText${label} is not valid.any string
autoCorrectfalseBoolean
autoCapitalizefalseBoolean
secureTextEntryfalseBoolean
keyboardType'default'keyboard types supported by RN
returnKeyType'go'returnKeyTypes supported by RN
errorTextStyle{ color: 'rgba(200, 0, 0, 0.8)', fontSize: 12 }style object
editableTextStyle{ height: 40, color: '#2d2d2d' }style object
readOnlyTextStyle{ height: 40, color: '#CCCCCC' }style object
onRefnonefunction
onSubmitEditingnonefunction

PasswordInput

<PasswordInput
  value={password}
  valid={!!password}
  editable={!this.props.fetching}
  onRef={r => { this.password = r }}
  togglePasswordControlColor='#F70044'
  borderBottomColor='#F70044'
  onChangeText={text => this.handleChange(text)}
  onSubmitEditing={() => null}
/>

PasswordInput props

  • All of the props for TextInput except label
PropsDefault valuesPossible values
confirmfalseBoolean
togglePasswordControlColornoneColor string (hex or rbg/a)