Skip to content

Fix iOS freeze when editing phone number#1217

Open
zaelgohary wants to merge 1 commit intodevelopmentfrom
development_fix_phone_edit_ios_freeze
Open

Fix iOS freeze when editing phone number#1217
zaelgohary wants to merge 1 commit intodevelopmentfrom
development_fix_phone_edit_ios_freeze

Conversation

@zaelgohary
Copy link
Copy Markdown
Contributor

Summary

The phone-edit dialog was calling setState() from inside the IntlMobileField validator. With AutovalidateMode.onUserInteraction (the package default), the validator runs on every keystroke during the form's build phase — calling setState() there schedules a rebuild while a build is in progress, which on iOS manifests as a screen freeze the moment the first digit is typed.

Related Issue

Closes #1214

Changes

  • Made the validator pure; moved state mutation into onChanged.
  • Derived _isValid from verificationPhoneNumber.isNotEmpty and reused a _isValidPhone helper across the validator and onChanged.
  • Guarded the per-keystroke setState so it only fires when the validity state actually changes.

Test Results

Tested on iPhone (iOS 26.4.1) — no freeze, can type a full number and submit.

@zaelgohary zaelgohary self-assigned this Apr 30, 2026
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

Successfully merging this pull request may close these issues.

Unable to edit phone number on iOS

1 participant