Gathering detailed insights and metrics for react-native-bpk-component-phone-input
Gathering detailed insights and metrics for react-native-bpk-component-phone-input
Gathering detailed insights and metrics for react-native-bpk-component-phone-input
Gathering detailed insights and metrics for react-native-bpk-component-phone-input
Backpack Design System for the Web
npm install react-native-bpk-component-phone-input
Typescript
Module System
Node Version
NPM Version
TypeScript (55.61%)
JavaScript (27.55%)
SCSS (16.69%)
Shell (0.13%)
HTML (0.02%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
522 Stars
8,386 Commits
205 Forks
121 Watchers
111 Branches
188 Contributors
Updated on Jul 11, 2025
Latest Version
7.0.2
Package Id
react-native-bpk-component-phone-input@7.0.2
Unpacked Size
127.12 kB
Size
15.72 kB
File Count
24
NPM Version
lerna/3.10.7/node@v12.16.1+x64 (darwin)
Node Version
12.16.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
11
3
Backpack React Native telephone input component.
1npm install react-native-bpk-component-phone-input --save-dev
Consumers are expected to provide the data that powers the two components available in this package.
Each supported country should be in the following format:
1{ id: 'UK', dialingCode: '+44', name: 'United Kingdom' }
All keys are required and should have non-null/empty values.
For BpkDialingCodeList
a list of objects with this format should be used. Sorting should be done beforehand as the component does not perform any sorting itself.
Optionally, you may supply a list of suggested ids which are your best guess at the user's country code. These codes will be shown at the top of the list under a custom title.
1import React, { Component } from 'react'; 2import { Image } from 'react-native'; 3import { BpkDialingCodeList } from 'react-native-bpk-component-phone-input'; 4 5const CODES = [ 6 { id: 'DZ', dialingCode: '+213', name: 'Algeria' }, 7 { id: 'CA', dialingCode: '+1', name: 'Canada' }, 8 { id: 'CD', dialingCode: '+243', name: 'Democratic Republic of the Congo' }, 9 { id: 'IT', dialingCode: '+39', name: 'Italy' }, 10 { id: 'JP', dialingCode: '+81', name: 'Japan' }, 11 { id: 'SE', dialingCode: '+46', name: 'Sweden' }, 12 { id: 'GB', dialingCode: '+44', name: 'United Kingdom' }, 13]; 14 15const FLAG_IMAGES = { 16 'DZ': '/resources/algeria.png', 17 'CA': '/resources/canada.png', 18 'CD': '/resources/drcongo.png', 19 'IT': '/resources/italy.png', 20 'JP': '/resources/japan.png', 21 'SE': '/resources/sweden.png', 22 'GB': '/resources/uk.png', 23}; 24 25const SUGGESTED = { 26 ids: ['IT', 'GB'], // The IDs must match the ones from dialingCodes 27 title: 'Suggested', // The title shown above the suggested codes 28}; 29 30export default class App extends Component { 31 render() { 32 return ( 33 <BpkDialingCodeList 34 dialingCodes={CODES} 35 selectedId="CD" 36 onItemPress={code => console.log(code.id)} 37 renderFlag={code => <Image source={require(FLAG_IMAGES[code.id])} />} 38 suggested={SUGGESTED} 39 /> 40 ); 41 } 42}
You can combine the dialing code list with SectionList
's search abilities to allow users to search the dialing code list.
A default filtering function - getFilteredDialingCodes
- is available for you to use. It filters using the dialingCode
and name
properties. You can either use this or provide your own filtering logic if you need advanced functionality.
1import React, { Component } from 'react'; 2import { Image } from 'react-native'; 3import { 4 BpkDialingCodeList, 5 getFilteredDialingCodes, 6} from 'react-native-bpk-component-phone-input'; 7import { 8 BpkSectionListNoResultsText, 9 BpkSectionListSearchField, 10} from 'react-native-bpk-component-section-list'; 11 12const CODES = [ 13 { id: 'DZ', dialingCode: '+213', name: 'Algeria' }, 14 { id: 'CA', dialingCode: '+1', name: 'Canada' }, 15 { id: 'CD', dialingCode: '+243', name: 'Democratic Republic of the Congo' }, 16 { id: 'IT', dialingCode: '+39', name: 'Italy' }, 17 { id: 'JP', dialingCode: '+81', name: 'Japan' }, 18 { id: 'SE', dialingCode: '+46', name: 'Sweden' }, 19 { id: 'GB', dialingCode: '+44', name: 'United Kingdom' }, 20]; 21 22const FLAG_IMAGES = { 23 'DZ': '/resources/algeria.png', 24 'CA': '/resources/canada.png', 25 'CD': '/resources/drcongo.png', 26 'IT': '/resources/italy.png', 27 'JP': '/resources/japan.png', 28 'SE': '/resources/sweden.png', 29 'GB': '/resources/uk.png', 30}; 31 32const SUGGESTED = { 33 ids: ['IT', 'GB'], // The IDs must match the ones from dialingCodes 34 title: 'Suggested', // The title shown above the suggested codes 35}; 36 37export default class App extends Component { 38 constructor() { 39 super(); 40 this.state = { 41 codes: CODES, 42 }; 43 } 44 45 doSearch = (searchText) => { 46 const codes = getFilteredDialingCodes(searchText, CODES); 47 this.setState({ codes }); 48 } 49 50 render() { 51 return ( 52 <BpkDialingCodeList 53 dialingCodes={this.state.codes} 54 selectedId="CD" 55 onItemPress={code => console.log(code.id)} 56 renderFlag={code => <Image source={require(FLAG_IMAGES[code.id])} />} 57 suggested={SUGGESTED} 58 ListHeaderComponent={ 59 <BpkSectionListSearchField placeholder="Search" onChangeText={this.doSearch} /> 60 } 61 ListEmptyComponent={ 62 <BpkSectionListNoResultsText>No results</BpkSectionListNoResultsText> 63 } 64 /> 65 ); 66 } 67}
Is an instance of React Native's SectionList component so it accepts the same props, as well as the following:
Property | PropType | Required | Default Value |
---|---|---|---|
dialingCodes | arrayOf({id, dialingCode, name}) | true | - |
onItemPress | func | true | - |
renderFlag | func | true | - |
selectedId | string | false | null |
suggested | { ids, title } | false | null |
1import React, { Component } from 'react'; 2import { Image } from 'react-native'; 3import { BpkPhoneNumberInput } from 'react-native-bpk-component-phone-input'; 4 5const CODES = [ 6 { id: 'DZ', dialingCode: '+213', name: 'Algeria' }, 7]; 8 9const FLAG_IMAGES = { 10 'DZ': '/resources/algeria.png', 11}; 12 13export default class App extends Component { 14 render() { 15 return ( 16 <BpkPhoneNumberInput 17 label="Phone number" 18 value="" 19 dialingCode={CODES[0]} 20 onDialingCodePress={() => presentDialingCodeList()} 21 renderFlag={code => <Image source={require(FLAG_IMAGES[code.id])} />} 22 /> 23 ); 24 } 25}
Inherits all props from BpkTextInput
except accessoryView
.
Property | PropType | Required | Default Value |
---|---|---|---|
dialingCode | {id, dialingCode, name} | true | - |
onDialingCodePress | func | true | - |
renderFlag | func | true | - |
1import React, { Component } from 'react'; 2import { Image } from 'react-native'; 3import { BpkFlag } from 'react-native-bpk-component-phone-input'; 4 5export default class App extends Component { 6 render() { 7 return ( 8 <BpkFlag 9 flag={<Image source={require('/resources/algeria.png')} />} 10 /> 11 ); 12 } 13}
Inherits all props from View
.
Property | PropType | Required | Default Value |
---|---|---|---|
flag | element | false | null |
width | number | false | spacingLg |
No vulnerabilities found.
Reason
all changesets reviewed
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
13 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
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 More