Skip to content

Fix iOS freeze when editing phone number#1217

Merged
zaelgohary merged 1 commit into
developmentfrom
development_fix_phone_edit_ios_freeze
May 4, 2026
Merged

Fix iOS freeze when editing phone number#1217
zaelgohary merged 1 commit into
developmentfrom
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
@zaelgohary zaelgohary requested a review from AhmedHanafy725 May 3, 2026 11:04
@zaelgohary zaelgohary merged commit e7b3c6f into development May 4, 2026
2 checks passed
@zaelgohary zaelgohary deleted the development_fix_phone_edit_ios_freeze branch May 4, 2026 09:28
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

2 participants