react-intl-tel-input
react-intl-tel-input copied to clipboard
Add a 'formatter' props to allow users to format numbers as they please
Hey,
I'd like to format my numbers using the google libphonenumber, but unfortunately I can't. Could you please add a prop to allow us to format the number? e.g.:
class TelInput extends Component {
static propTypes = {
[...]
formatter: PropTypes.func,
};
render() {
return (
<input type="tel" autoComplete="off"
[...]
value={this.props.formatter ? this.props.formatter(this.props.value) : this.props.value}
/>
);
}
}
export default TelInput;
Thanks in advance!
It would also be nice to have an onPhoneNumberFocus
prop to match onPhoneNumberBlur
.
I too would like to do the same. Namely to remove the +52 or +1 prefix from the numbers (as I want that country code in the flag-box).