1.0.5 • Published 3 years ago

react-native-character-input v1.0.5

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

react-native-character-input

platforms npm npm github issues github closed issues


Getting started

$ npm install react-native-character-input --save

Import

import CharacterInput from 'react-native-character-input'

Usage

npm.io

<CharacterInput
	placeHolder='YYYY/MM/DD'
	showCharBinary='1111011011'
	handleChange={(value) => setValue(value)}
	inputType='underlined'
	keyboardType='numeric'
/>

npm.io

<CharacterInput
	placeHolder='YYYY/MM/DD'
	showCharBinary='1111011011'
	handleChange={(value) => setValue(value)}
	inputType='outlined'
	keyboardType='numeric'
/>

npm.io

<CharacterInput
	placeHolder='YYYY/MM/DD'
	showCharBinary='1111011011'
	handleChange={(value) => setValue(value)}
	inputType='contained'
	keyboardType='numeric'
/>

Available Props

NameTypeRequired?Description
placeHolderstringyesString of place holder characters.
showCharBinarystringyesString of 1 or 0, indicates if corresponding character should be editable or not
handleChangefunction(value: string) => voidyesReturns a string of modifiable characters (1) stripped of disabled characters (0).
keyboardTypestringnoSame as TextInput component from react-native
inputTypestringnoDefault underlined, Options include: underlined, outlined, and contained
permanentTextStyleStyleSheetnoStyles Text component of disabled characters
containerStyleStyleSheetnoContained style of each character input
inputStyleStyleSheetnoInput style of each character input
inputContainerStyleStyleSheetnoInput container style of each character input
placeHolderTextColorStyleSheetnoPlace holder text color
autoFocusbooleannoauto focus on first character input

Features to come

1) handleChange function will return both stripped and raw input values(both modifiable and disabled characters). 2) Allow masked character inputs. - Will implement a way to specify an object of keys to REGEX values. - This will allow you to specify a mask string of keys/permanent characters. Permanent characters are not mapped as keys and keys have an associated REGEX as its rule to change the character input value. - This one will take me a while :)