Closed camilopl33 closed 5 months ago
I explored the code and tested further, and found that it only fails when the value doesn't start with the current dial code. I believe there is an issue with the second case condition in the phone number formatting logic.
! IMPORTANT:
This bug solution is resolve with update the dependency to version 4.3.0 and this resolve the error if you use the UI library MUI:
Describe the bug
The phone component does not work correctly with default values and the forceDialCode prop. No matter how many times you provide data to set a default value, the component does not detect it if this property is active.
To Reproduce
Steps to reproduce the behavior:
Code sandbox
https://codesandbox.io/p/sandbox/react-international-phone-demo-forked-k3yj2c?
Additional context
This issue occurs when the forceDialCode prop is used in conjunction with setting a default phone number value. The component should properly initialize with the provided default value but fails to do so when forceDialCode is active.