Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not delete the ")" #12

Open
k2on opened this issue Oct 17, 2023 · 2 comments
Open

Can not delete the ")" #12

k2on opened this issue Oct 17, 2023 · 2 comments

Comments

@k2on
Copy link

k2on commented Oct 17, 2023

When I enter an area code and its formatted like this "(500)", I cannot delete the ")"

@k2on
Copy link
Author

k2on commented Oct 17, 2023

I fixed it with this but idk if its the best way to do it of if im doing something wrong

   28         case 'processInput':                                         
   27           const inputTextHandler = new AsYouType(                                         
   26             state.countryCode as CountryCode                                         
   25           );                                         
   24           let input = payload;                                         
   23           if (state.formattedText.length == 5 && payload.length == 4) input = (state.formattedText as string).substring(0, 3);                                         
   22                                           
   21           const formattedText = inputTextHandler.input(input);                                         
   20                                           
   19           // handles auto-complete input                                         
   18           if (inputTextHandler.isInternational()) {                                         
   17             const countryCode = inputTextHandler.getCountry() as string;                                         
   16             const countryTel = inputTextHandler.getCallingCode();                                         
   15             return {                                         
   14               ...state,                                         
   13               countryTel,                                         
   12               countryCode,                                         
   11               formattedText:                                         
   10                 inputTextHandler.getNumber()?.formatNational() || '',                                         
    9               number: inputTextHandler.getNumberValue() as string,                                         
    8             };                                         
    7           }                                         
    6                                           
    5           return {                                         
    4             ...state,                                         
    3             inputText: input,                                         
    2             formattedText: formattedText,                                         
    1             number: inputTextHandler.getNumberValue() as string,                                         
    0           };   

@k2on
Copy link
Author

k2on commented Oct 17, 2023

i made a new input variable that replaces payload

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant