catamphetamine / react-phone-number-input

React component for international phone number input
http://catamphetamine.gitlab.io/react-phone-number-input/
MIT License
914 stars 194 forks source link

Passing onBlur as a prop to the component #369

Closed kash0296 closed 3 years ago

kash0296 commented 3 years ago

Hi, Does the component support the use of the onBlur event instead of the onChange event? I pass props to the component like this in my form: return( <PhoneInput international defaultCountry={this.state.defaultCountry} value={props.value} required={props.required} disabled={props.disabled} onChange={(value) => props.onChange(value)} className="form-control-phone" /> This works fine. However I would love to use onBlur instead of onChange if possible. If I try the following: return( <PhoneInput international defaultCountry={this.state.defaultCountry} value={props.value} required={props.required} disabled={props.disabled} onBlur={(value) => props.onBlur(value)} className="form-control-phone" /> Is it possible to use onBlur? When I was browsing the repository, I saw onBlur only being available to countryselect component and input component.

Thank you!

catamphetamine commented 3 years ago

onBlur is passed through directly to the <input/>.