Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@nandorojo/react-native-phone-input
Advanced tools
Readme
The react-native-phone-input
seems unmaintained, so this is meant to address some bugs.
◻️ Typescript support ◻️ Fix refs support ◻️ Web support
Phone input box for React Native
yarn add @nandorojo/react-native-phone-input
import PhoneInput from "@nandorojo/react-native-phone-input";
export default () => {
const ref = useRef();
return <PhoneInput ref={ref} />;
};
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
use awesome react-native-country-picker-modal to select country
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
<PhoneInput countriesList={require("./countries.json")} />
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 |
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 |
FAQs
Phone input box for React Native, forked by Doorman.
The npm package @nandorojo/react-native-phone-input receives a total of 95 weekly downloads. As such, @nandorojo/react-native-phone-input popularity was classified as not popular.
We found that @nandorojo/react-native-phone-input demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.