1.0.8 • Published 3 years ago

@my_name_is_nero/input-phone v1.0.8

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

React Native Phone Input

Phone number input field.

npm.io

React Native Phone Input With Mask

Phone number input field with supporting mask

npm.io

Installation

npm i --save @my_name_is_nero/input-phone

Basic Usage

import React from 'react';
import {View, StyleSheet} from 'react-native';
import {InputPhone, InputPhoneWithMask} from '@my_name_is_nero/input-phone';

const styles = StyleSheet.create({
  containerStyle: {
    flex:1,
  }
});

export default function App() {
  const [phoneNumber, setPhoneNumber] = React.useState({countryCode: '', phoneNumber: ''});
  const [phoheNumberWithMask, setPhoneNumberWithMask] = React.useState({countryCode: '', phoneNumber: '', phoneWithMask:""})
  
  return (
    <View style={styles.containerStyle}>
      <InputPhone value={phoneNumber} onChangeText={setPhoneNumber} />
      <InputPhone mask="(##)-##-###-##"  value={phoneNumber} onChangeText={setPhoneNumber} />
    </View>
  )
}

Props

By default component support all props from TextInput (multiline always set to false). Also component have additions props like:

Phone number input field

NameDefaultValueDescriptionRequired
placeholderEnter phone numberInput phone number placeholderfalse
containerStyleMain container stylefalse
inputContainerStylePhone number input container stylefalse
inputStylePhone number input value stylefalse
messageBottom text hintfalse
messageStyleBottom text hint stylefalse
labelLabel textfalse
labelStyleLabel text stylefalse
codeStyleStyle for changing style of country codefalse
flagContainerStyleStyle for country imagefalse

Phone number input field with mask

NameDefaultValueDescriptionRequired
placeholderEnter phone numberInput phone number placeholderfalse
containerStyleMain container stylefalse
inputContainerStylePhone number input container stylefalse
inputStylePhone number input value stylefalse
messageBottom text hintfalse
messageStyleBottom text hint stylefalse
labelLabel textfalse
labelStyleLabel text stylefalse
codeStyleStyle for changing style of country codefalse
flagContainerStyleStyle for country imagefalse
maskMask for input fieldtrue

Search query input field

NameDescriptionDefault Value
placeholderSearchSearch input placeholderSearch
searchInputContainerStyleSearch field container style
searchInputStyleSearch field value style

Country list

NameDescription
listContainerStyleMain container style for country list
listStyleContainer style for country list
listContentContainerStyleContainer style for country list
itemContainerStyleContainer item style inside country list
itemStyleValue style inside country list
itemCodeStyleCode style inside country list
1.0.8

3 years ago

1.0.7

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago