material-ui-phone-number icon indicating copy to clipboard operation
material-ui-phone-number copied to clipboard

Crashes the app if field left empty

Open raphaelpinel opened this issue 5 years ago • 0 comments

If the user tries to delete the entire phone number, it stays only '+' which is annoying. More problematic, if he try to exit the form, the app crashes with this error:

index.js:2526 Uncaught TypeError: Cannot read property 'dialCode' of undefined
    at e.updateDefaultCountry (index.js:2526)
    at e.value (index.js:2945)

Here is my code <MuiPhoneNumber className={classes.phoneInput} style={{ width: formInputWidth }} defaultCountry={defaultCountryCode} disableAreaCodes={true} placeholder="Mobile number" value={props.phone} onChange={onChangePhone} label={'Mobile'} error={props.tfa && !props.phone} helperText={props.tfa && !props.phone ? t('validation.requiredField') : ''} required={props.tfa} localization={localization} />

raphaelpinel avatar Jan 13 '20 07:01 raphaelpinel