Installations
npm install react-native-phone-number-input
Score
54.7
Supply Chain
54.7
Quality
67
Maintenance
50
Vulnerability
94.8
License
Developer
garganurag893
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
NPM Version
Statistics
377 Stars
39 Commits
219 Forks
4 Watching
16 Branches
3 Contributors
Updated on 25 Nov 2024
Languages
JavaScript (37.27%)
Java (24.28%)
Objective-C (18.85%)
TypeScript (14.63%)
Ruby (2.61%)
Starlark (2.36%)
Total Downloads
Cumulative downloads
Total Downloads
2,994,179
Last day
-4.4%
7,362
Compared to previous day
Last week
-3.2%
37,148
Compared to previous week
Last month
15.4%
161,286
Compared to previous month
Last year
65.2%
1,369,913
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
2
Dev Dependencies
1
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
Want to show your love?
Click on 🌟 button.
Table of Contents
Installation
1$ yarn add react-native-phone-number-input
OR
1$ npm i react-native-phone-number-input --save
Features
- :iphone: Works with iOS and Android, Cross-platform :100:
- :crossed_flags: Built-in country picker (uses react-native-country-picker-modal)
- :wrench: Completely customizable UI!
- :heavy_check_mark: Proper validation (uses google-libphonenumber)
Usage
For more complete example open App.tsx
1import React, { useState, useRef } from "react"; 2import { 3 SafeAreaView, 4 StyleSheet, 5 View, 6 StatusBar, 7 TouchableOpacity, 8 Text, 9} from "react-native"; 10import PhoneInput from "react-native-phone-number-input"; 11import { Colors } from "react-native/Libraries/NewAppScreen"; 12 13const App: React.FC = () => { 14 const [value, setValue] = useState(""); 15 const [formattedValue, setFormattedValue] = useState(""); 16 const [valid, setValid] = useState(false); 17 const [showMessage, setShowMessage] = useState(false); 18 const phoneInput = useRef<PhoneInput>(null); 19 return ( 20 <> 21 <StatusBar barStyle="dark-content" /> 22 <View style={styles.container}> 23 <SafeAreaView style={styles.wrapper}> 24 {showMessage && ( 25 <View style={styles.message}> 26 <Text>Value : {value}</Text> 27 <Text>Formatted Value : {formattedValue}</Text> 28 <Text>Valid : {valid ? "true" : "false"}</Text> 29 </View> 30 )} 31 <PhoneInput 32 ref={phoneInput} 33 defaultValue={value} 34 defaultCode="DM" 35 layout="first" 36 onChangeText={(text) => { 37 setValue(text); 38 }} 39 onChangeFormattedText={(text) => { 40 setFormattedValue(text); 41 }} 42 withDarkTheme 43 withShadow 44 autoFocus 45 /> 46 <TouchableOpacity 47 style={styles.button} 48 onPress={() => { 49 const checkValid = phoneInput.current?.isValidNumber(value); 50 setShowMessage(true); 51 setValid(checkValid ? checkValid : false); 52 }} 53 > 54 <Text>Check</Text> 55 </TouchableOpacity> 56 </SafeAreaView> 57 </View> 58 </> 59 ); 60}; 61 62export default App;
Props
defaultCode?
: CountryCodewithDarkTheme?
: booleanwithShadow?
: booleanautoFocus?
: booleandefaultValue?
: stringvalue?
: stringdisabled?
: booleandisableArrowIcon?
: booleanplaceholder?
: 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
: () => CountryCodegetCallingCode
: () => string | undefinedgetNumberAfterPossiblyEliminatingZero
: () => {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
- 👯 Clone this repo to your local machine using
Step 2
- HACK AWAY! 🔨🔨🔨
Step 3
- 🔃 Create a new pull request using
https://github.com/garganurag893/react-native-phone-number-input
.
Support
Reach out to me at one of the following places!
- Twitter at https://twitter.com/AnuragG94634191
- Medium at https://medium.com/@garganurag893
- Instagram at https://www.instagram.com/the_only_anurag/
- Email at garganurag893@gmail.com
License
Hire
Looking for a React/React-Native Freelance Expert? Email at garganurag893@gmail.com
No vulnerabilities found.
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
binaries present in source code
Details
- Warn: binary detected: example/android/gradle/wrapper/gradle-wrapper.jar:1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/26 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 6 are checked with a SAST tool
Reason
44 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-f5x2-xv93-4p23
- Warn: Project is vulnerable to: GHSA-gmpm-xp43-f7g6
- Warn: Project is vulnerable to: GHSA-pf27-929j-9pmm
- Warn: Project is vulnerable to: GHSA-327c-qx3v-h673
- Warn: Project is vulnerable to: GHSA-x4cf-6jr3-3qvp
- Warn: Project is vulnerable to: GHSA-mph8-6787-r8hw
- Warn: Project is vulnerable to: GHSA-7mhc-prgv-r3q4
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-4cpg-3vgw-4877
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-rxrc-rgv4-jpvx
- Warn: Project is vulnerable to: GHSA-7f53-fmmv-mfjv
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-gff7-g5r8-mg8m
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-5fg8-2547-mr8q
- Warn: Project is vulnerable to: GHSA-crh6-fp67-6883
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
Score
1.6
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to react-native-phone-number-input
react-phone-number-input
Telephone number input React component
libphonenumber-js
A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript
react-native-international-phone-number
International mobile phone input component with mask for React Native
react-phone-input-2
A react component to format phone numbers