Skip to content

Commit 16e5db9

Browse files
committed
create new instance whenever country changes
1 parent 0e8c61c commit 16e5db9

File tree

1 file changed

+4
-1
lines changed
  • projects/packages/forms/src/modules/field-phone

1 file changed

+4
-1
lines changed

projects/packages/forms/src/modules/field-phone/view.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ const { actions } = store( NAMESPACE, {
7777
},
7878
onPhoneCountryChange( event ) {
7979
const context = getContext();
80-
context.countryPrefix = countries.find( item => item.code === event?.target?.value )?.value;
8180
context.phoneCountryCode = event?.target?.value || context.defaultCountry;
81+
context.countryPrefix = countries.find(
82+
item => item.code === context.phoneCountryCode
83+
)?.value;
84+
asYouTypes[ context.fieldId ] = new AsYouType( context.phoneCountryCode );
8285
context.fullPhoneNumber = context.countryPrefix + ' ' + context.phoneNumber;
8386
},
8487
},

0 commit comments

Comments
 (0)