1.1.3 • Published 7 years ago

rn-phone-number-mask v1.1.3

Weekly downloads
55
License
MIT
Repository
github
Last release
7 years ago

rn-phone-number-mask

US telephone mask for text input

Instalation

npm i rn-phone-number-mask

Example

Transforms 1234567890 into (123) 456-7890 dynamically

Usage

Import

import PhoneNumberMask from 'rn-phone-number-mask'

And use it this way:

<PhoneNumberMask
  containerStyle={styles.containerStyle}
  style={styles.inputStyle}
  onNumberChange={phoneNumber => this.setState({ phoneNumber })} />

Props

PropDescriptionTypeDefault
onNumberChangeThis function is triggered when TextInput value changes (returns value with mask applied)FunctionRequired
containerStyleTextInput container styleObject{}
styleInputText styleObject{}
maxLengthMax length of phone numberNumber14

Enjoy!