You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PhoneInput: controllable country + detect country from pasted numbers #31
This breaks the library's controlled/uncontrolled convention (see ARCHITECTURE.md) — a parent can't change or reset the country, and changing defaultCountry after mount does nothing.
Proposal
Add country / onCountryChange and route both through useControllableState; keep defaultCountry for uncontrolled use.
When the user types or pastes a number starting with + (e.g. +44 20 7946 0958), match the longest dial code, switch the country and strip the prefix from the input value.
Shared dial codes (+1 US/CA, +7 RU/KZ): keep the currently selected country if it matches, else pick the first.
Acceptance
Tests: controlled country follows parent; paste +44… selects GB; +1 keeps CA if CA selected
Activity
ujwalbajaj commentedon Oct 24, 2026
Hey @sapatmohit can you assign this issue to me, I am interested in working on this!
sapatmohit commentedon Oct 24, 2026
Done!!