Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Commit

Permalink
fix(PhoneInput): Cast null to empty string (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylealwyn authored Apr 24, 2019
1 parent 7b18d5a commit c311c6c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Form/PhoneInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ function PhoneInput({ countryCode, forwardedRef, value: propValue, onKeyDown, on
throw new Error(`${countryCode} is not supported`);
}

const format = (value = '') => {
const parsed = parseDigits(value).substr(0, getRawMaxLength(countryCode, value));
const format = value => {
const phoneString = value || '';
const parsed = parseDigits(phoneString).substr(0, getRawMaxLength(countryCode, phoneString));
return new AsYouType(countryCode).input(parsed);
};

Expand Down

0 comments on commit c311c6c

Please sign in to comment.