thegamenicorus / react-native-phone-input

Phone input box for React Native
https://www.npmjs.com/package/react-native-phone-input
MIT License
395 stars 450 forks source link

Setting phone input value not working properly #58

Open oormilavarma opened 6 years ago

oormilavarma commented 6 years ago

<PhoneInput keyboardType={'numeric'} initialCountry='in' value='+91' ref={(ref) => {this.phone = ref;}} onChangePhoneNumber={(number) => {this.setState({mobile_no: number})}} />

If I try to clear the phone input completely , the number is getting cleared and only the flag is resetting. And if I again choose the same country, the country code (or dial code) is not showing up. Is there any way I fix this?

GSolari79 commented 6 years ago

Could you please share how to reset it's value? Thanks in advance

gimoteco commented 4 years ago

Hello, it's possible to set an empty value through component inner set state

phoneInputRef.current!.setState({
    inputValue: '',
})