All Projects → garganurag893 → react-native-phone-number-input

garganurag893 / react-native-phone-number-input

Licence: MIT License
React Native component for phone number.

Programming Languages

javascript
184084 projects - #8 most used programming language
java
68154 projects - #9 most used programming language
objective c
16641 projects - #2 most used programming language
typescript
32286 projects
ruby
36898 projects - #4 most used programming language
Starlark
911 projects

Projects that are alternatives of or similar to react-native-phone-number-input

csv2vcf
🔧 Simple script in python to convert CSV files to VCF
Stars: ✭ 66 (-67.96%)
Mutual labels:  phone-number
botkit-sms
Twilio Programmable SMS implementation for Botkit.
Stars: ✭ 18 (-91.26%)
Mutual labels:  phone-number
phone-number-geo
离线查询手机号归属地
Stars: ✭ 88 (-57.28%)
Mutual labels:  phone-number
rust-phonenumber
Library for parsing, formatting and validating international phone numbers.
Stars: ✭ 99 (-51.94%)
Mutual labels:  phone-number
nova-phone-number
A Laravel Nova field to format and validate phone numbers.
Stars: ✭ 60 (-70.87%)
Mutual labels:  phone-number
PhoneNumberKit
Android Kotlin library to parse and format international phone numbers. Country code picker.
Stars: ✭ 124 (-39.81%)
Mutual labels:  phone-number
Faker
A library for generating fake data such as names, addresses, and phone numbers.
Stars: ✭ 231 (+12.14%)
Mutual labels:  phone-number
haoma
手机固话电话号码标记批量查询📞📌
Stars: ✭ 52 (-74.76%)
Mutual labels:  phone-number
getcontact
Find info about user by phone number using GetContact API
Stars: ✭ 228 (+10.68%)
Mutual labels:  phone-number
naija-phone-number
A fast minimal module to validate Nigerian mobile phone numbers using Regular Expressions.
Stars: ✭ 43 (-79.13%)
Mutual labels:  phone-number
static-calltracking
Скрипт подмены номеров для статического коллтрекинга
Stars: ✭ 18 (-91.26%)
Mutual labels:  phone-number
international-telephone-input
Integration to Magento 2 a jQuery plugin for entering and validating international telephone numbers.
Stars: ✭ 26 (-87.38%)
Mutual labels:  phone-number
Reborn
ReborN SMS BOMBER | SpeedX & 4NAT
Stars: ✭ 126 (-38.83%)
Mutual labels:  phone-number
disposable-phone-numbers
A list of disposable phone numbers
Stars: ✭ 35 (-83.01%)
Mutual labels:  phone-number
CHRTextFieldFormatter
Provides UITextField formatting masks. Such as phone number and credit card number formatters.
Stars: ✭ 52 (-74.76%)
Mutual labels:  phone-number
flutter otp
A Flutter package for iOS and Android for sending and verifying OTP to a Phone number.
Stars: ✭ 59 (-71.36%)
Mutual labels:  phone-number
magento2-sign-in-with-phone-number
This extension allow your customers to login to your Magento store using their phone number.
Stars: ✭ 42 (-79.61%)
Mutual labels:  phone-number
ember-phone-input
An Ember.js component to handle international phone numbers
Stars: ✭ 22 (-89.32%)
Mutual labels:  phone-number
intl-tel-input-rails
intl-tel-input for the Rails asset pipeline
Stars: ✭ 35 (-83.01%)
Mutual labels:  phone-number
react-headless-phone-input
Headless phone number input component for React. Because phone numbers are hard.
Stars: ✭ 25 (-87.86%)
Mutual labels:  phone-number
Anurag Garg Anurag Garg

React Native Phone Number Input

Performance oriented React Native Phone Number Input with typings and proper validation for any country.

Made with ❤️ by developer for developers

build build build build

Want to show your love?

Click on 🌟 button.

Table of Contents

Installation

$ yarn add react-native-phone-number-input

OR

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

Features

Usage

For more complete example open App.tsx

import React, { useState, useRef } from "react";
import {
  SafeAreaView,
  StyleSheet,
  View,
  StatusBar,
  TouchableOpacity,
  Text,
} from "react-native";
import PhoneInput from "react-native-phone-number-input";
import { Colors } from "react-native/Libraries/NewAppScreen";

const App: React.FC = () => {
  const [value, setValue] = useState("");
  const [formattedValue, setFormattedValue] = useState("");
  const [valid, setValid] = useState(false);
  const [showMessage, setShowMessage] = useState(false);
  const phoneInput = useRef<PhoneInput>(null);
  return (
    <>
      <StatusBar barStyle="dark-content" />
      <View style={styles.container}>
        <SafeAreaView style={styles.wrapper}>
          {showMessage && (
            <View style={styles.message}>
              <Text>Value : {value}</Text>
              <Text>Formatted Value : {formattedValue}</Text>
              <Text>Valid : {valid ? "true" : "false"}</Text>
            </View>
          )}
          <PhoneInput
            ref={phoneInput}
            defaultValue={value}
            defaultCode="DM"
            layout="first"
            onChangeText={(text) => {
              setValue(text);
            }}
            onChangeFormattedText={(text) => {
              setFormattedValue(text);
            }}
            withDarkTheme
            withShadow
            autoFocus
          />
          <TouchableOpacity
            style={styles.button}
            onPress={() => {
              const checkValid = phoneInput.current?.isValidNumber(value);
              setShowMessage(true);
              setValid(checkValid ? checkValid : false);
            }}
          >
            <Text>Check</Text>
          </TouchableOpacity>
        </SafeAreaView>
      </View>
    </>
  );
};

export default App;

Props

  • defaultCode?: CountryCode
  • withDarkTheme?: boolean
  • withShadow?: boolean
  • autoFocus?: boolean
  • defaultValue?: string
  • value?: string
  • disabled?: boolean
  • disableArrowIcon?: boolean
  • placeholder?: string;
  • onChangeCountry?: (country: Country) => void;
  • onChangeText?: (text: string) => void;
  • onChangeFormattedText?: (text: string) => void;
  • containerStyle?: StyleProp<ViewStyle>;
  • textContainerStyle?: StyleProp<ViewStyle>;
  • renderDropdownImage?: JSX.Element;
  • textInputProps?: TextInputProps;
  • textInputStyle?: StyleProp<TextStyle>;
  • codeTextStyle?: StyleProp<TextStyle>;
  • flagButtonStyle?: StyleProp<ViewStyle>;
  • countryPickerButtonStyle : StyleProp<ViewStyle>;
  • layout?: "first" | "second";
  • filterProps?: CountryFilterProps;
  • countryPickerProps?: any;

Methods

  • getCountryCode: () => CountryCode
  • getCallingCode: () => string | undefined
  • getNumberAfterPossiblyEliminatingZero: () => {number: string , formattedNumber: string };
  • isValidNumber: (number: string) => boolean

FAQ

Is it supported and tested both on android and iOS?

YES

NSURLResponse allHeaderFields: unrecognized selector sent to instance XX crash?

Upgrade versions['Flipper'] ||= '~> 0.37.0' in podfile.

Contributing

To get started...

Step 1

  • Option 1

    • 🍴 Fork this repo!
  • Option 2

    • 👯 Clone this repo to your local machine using https://github.com/garganurag893/react-native-phone-number-input

Step 2

  • HACK AWAY! 🔨🔨🔨

Step 3

Support

Reach out to me at one of the following places!

License

License

Hire

Looking for a React/React-Native Freelance Expert? Email at [email protected]

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].