Skip to content

Country flag switches incorrectly between Russia and Kazakhstan for +7 numbers #724

Description

@mahesh70205333

Description

The library incorrectly handles phone numbers with country code +7, which is shared by Russia and Kazakhstan.

Steps to Reproduce

  1. Select phone input
  2. Enter +7
  3. Continue typing:
    • Enter 7 and any number → flag switches to Russia

Expected Behavior

  • Library should NOT immediately assign Kazakhstan on +7
  • It should wait for next digits before deciding country
  • Correct logic:
    • +7 6xx / +7 7xx → Kazakhstan
    • +7 9xx → Russia

Actual Behavior

  • Default country becomes Kazakhstan immediately after +7
  • Incorrect or delayed switching of flags
  • Creates confusion for users

Suggestion

  • Delay country detection until sufficient digits entered
  • OR allow disabling auto-detection
  • OR prioritize prefix-based logic instead of default country

Impact

  • Incorrect country flag shown
  • Bad user experience
  • Wrong data may be submitted

Environment

  • Library: react-phone-input-2
  • Version: react-phone-input-2: ^2.15.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions