From 49805b90681686719c98c77cc7253c0968abd553 Mon Sep 17 00:00:00 2001 From: Stephen Malek Date: Wed, 15 Feb 2023 15:14:13 -0700 Subject: [PATCH] Allow a force of country flag on initialization --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 07988e0f..25528f1e 100644 --- a/src/index.js +++ b/src/index.js @@ -189,12 +189,12 @@ class PhoneInput extends React.Component { let countryGuess; if (props.disableInitialCountryGuess) { countryGuess = 0; - } else if (inputNumber.length > 1) { - // Country detect by phone - countryGuess = this.guessSelectedCountry(inputNumber.substring(0, 6), props.country, onlyCountries, hiddenAreaCodes) || 0; } else if (props.country) { // Default country countryGuess = onlyCountries.find(o => o.iso2 == props.country) || 0; + } else if (inputNumber.length > 1) { + // Country detect by phone + countryGuess = this.guessSelectedCountry(inputNumber.substring(0, 6), props.country, onlyCountries, hiddenAreaCodes) || 0; } else { // Empty params countryGuess = 0;