All Projects → thegamenicorus → React Native Phone Input

thegamenicorus / React Native Phone Input

Licence: mit
Phone input box for React Native

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Phone Input

Vue Phone Number Input
A phone number input made with Vue JS (format & valid phone number)
Stars: ✭ 407 (+14.33%)
Mutual labels:  phone, input
Vue Tel Input
International Telephone Input with Vue https://educationlink.github.io/vue-tel-input/
Stars: ✭ 443 (+24.44%)
Mutual labels:  phone, input
React Phone Input 2
📞 Highly customizable phone input component with auto formatting
Stars: ✭ 446 (+25.28%)
Mutual labels:  phone, input
Md Date Time Picker
An implementation of Material Design Picker components in vanilla CSS, JS, and HTML
Stars: ✭ 272 (-23.6%)
Mutual labels:  input
React Dropzone Uploader
React file dropzone and uploader
Stars: ✭ 276 (-22.47%)
Mutual labels:  input
Social Media Profiles Regexs
📇 Extract social media profiles and more with regular expressions
Stars: ✭ 324 (-8.99%)
Mutual labels:  phone
File Upload With Preview
🖼 A simple file-upload utility that shows a preview of the uploaded image. Written in pure JavaScript. No dependencies. Works well with Bootstrap 4 or without a framework.
Stars: ✭ 352 (-1.12%)
Mutual labels:  input
Soup
☎️ Original open source call flooder using Twilio's API.
Stars: ✭ 267 (-25%)
Mutual labels:  phone
Androrat
AndroRAT | Remote Administrator Tool for Android OS Hacking
Stars: ✭ 340 (-4.49%)
Mutual labels:  phone
Vonage Node Sdk
Vonage API client for Node.js. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Stars: ✭ 323 (-9.27%)
Mutual labels:  phone
Vxe Table
🐬 vxe-table vue 表格解决方案
Stars: ✭ 4,242 (+1091.57%)
Mutual labels:  input
Cutie
Command line User Tools for Input Easification
Stars: ✭ 282 (-20.79%)
Mutual labels:  input
Validator.js
String validation
Stars: ✭ 18,842 (+5192.7%)
Mutual labels:  input
Input Range Scss
Styling Cross-Browser Compatible Range Inputs with Sass
Stars: ✭ 272 (-23.6%)
Mutual labels:  input
Vue Numeric
Input field component to display a formatted currency value based on Vue.js
Stars: ✭ 341 (-4.21%)
Mutual labels:  input
Commodity Injection Signatures
Commodity Injection Signatures, Malicious Inputs, XSS, HTTP Header Injection, XXE, RCE, Javascript, XSLT
Stars: ✭ 267 (-25%)
Mutual labels:  input
Home Automation
Raspberry Pi 3 based home automation with NodeJS and React Native.
Stars: ✭ 3,395 (+853.65%)
Mutual labels:  phone
Tags Input
🔖 <input type="tags"> like magic
Stars: ✭ 312 (-12.36%)
Mutual labels:  input
Rime Wubi86 Jidian
86五笔极点码表 for Rime (鼠须管 - macOS)(小狼毫 - Windows)五笔输入法
Stars: ✭ 302 (-15.17%)
Mutual labels:  input
Rofimoji
An emoji and character picker for rofi 😁
Stars: ✭ 319 (-10.39%)
Mutual labels:  input

React Native Phone Input

Phone input box for React Native

2560-02-07 01_32_33 2560-02-08 00_04_18

Installation

npm i react-native-phone-input --save

Basic Usage

import PhoneInput from 'react-native-phone-input'

render(){
    return(
        <PhoneInput ref='phone'/>
    )
}

see full basic example

Custom Your Own Picker

2560-02-08 01_10_22 2560-02-08 01_46_21
  1. in componentDidMount, keep this.phone.getPickerData() in state
  2. create function for open your modal (onPressFlag in example)
  3. <PhoneInput onPressFlag={function in 2.} />
  4. call this.phone.selectCountry for set country of <PhoneInput />
componentDidMount(){
    this.setState({
        pickerData: this.phone.getPickerData()
    })
}

onPressFlag(){
    this.myCountryPicker.open()
}

selectCountry(country){
    this.phone.selectCountry(country.iso2)
}

render(){
    return(
        <View style={styles.container}>
            <PhoneInput
                ref={(ref) => { this.phone = ref; }}
                onPressFlag={this.onPressFlag}
            />

            <ModalPickerImage
                ref={(ref) => { this.myCountryPicker = ref; }}
                data={this.state.pickerData}
                onChange={(country)=>{ this.selectCountry(country) }}
                cancelText='Cancel'
            />
        </View>
    )
}

see full custom picker example

Custom Library Picker

use awesome react-native-country-picker-modal to select country

2560-02-08 02_26_20 2560-02-08 02_43_18
onPressFlag(){
    this.countryPicker.openModal()
}

selectCountry(country){
    this.phone.selectCountry(country.cca2.toLowerCase())
    this.setState({cca2: country.cca2})
}

render(){
    return(
        <View style={styles.container}>
            <PhoneInput
                ref={(ref) => { this.phone = ref; }}
                onPressFlag={this.onPressFlag}
            />

            <CountryPicker
                ref={(ref) => { this.countryPicker = ref; }}
                onChange={(value)=> this.selectCountry(value)}
                translation='eng'
                cca2={this.state.cca2}
            >
                <View></View>
            </CountryPicker>
        </View>
    )
}

see full custom library picker example

Custom Countries

<PhoneInput countriesList={require('./countries.json')} />

Configuration

Properties:

Property Name Type Default Description
initialCountry string 'us' initial selected country
allowZeroAfterCountryCode bool true allow user input 0 after country code
disabled bool false if true, disable all interaction of this component
value string null initial phone number
style object null custom styles to be applied if supplied
flagStyle object null custom styles for flag image eg. {{width: 50, height: 30, borderWidth:0}}
textStyle object null custom styles for phone number text input eg. {{fontSize: 14}}
textProps object null properties for phone number text input eg. {{placeholder: 'Telephone number'}}
textComponent function TextField the input component to use
offset int 10 distance between flag and phone number
pickerButtonColor string '#007AFF' set button color of country picker
pickerBackgroundColor string 'white' set background color of country picker
pickerItemStyle object null custom styles for text in country picker eg. {{fontSize: 14}}
cancelText string 'Cancel' cancel word
confirmText string 'Confirm' confirm word
buttonTextStyle object null custom styles for country picker button
onChangePhoneNumber function(number) null function to be invoked when phone number is changed
onSelectCountry function(iso2) null function to be invoked when country picker is selected
onPressFlag function() null function to be invoked when press on flag image
countriesList array null custom countries list
autoFormat bool false automatically format phone number as it is entered

Functions:

Function Name Return Type Parameters Description
isValidNumber boolean none return true if current phone number is valid
getNumberType string none return true type of current phone number
getValue string none return current phone number
getFlag object iso2:string return flag image
getAllCountries object none return country object in country picker
getPickerData object nont return country object with flag image
focus void none focus the phone input
blur void none blur the phone input
selectCountry void iso2:string set phone input to specific country
getCountryCode string none return country dial code of current phone number
getISOCode string none return country iso code of current phone number
onPressCancel func none handler to be called when taps the cancel button
onPressConfirm func none handler to be called when taps the confirm button
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].