Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Only change default region if the withFlag is true (#593)
Browse files Browse the repository at this point in the history
  • Loading branch information
otusweb authored Jan 23, 2023
1 parent 56f612e commit 80acec2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions PhoneNumberKit/UI/PhoneNumberTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,14 @@ open class PhoneNumberTextField: UITextField, UITextFieldDelegate {
}

// we change the default region to be the one most recently typed
self._defaultRegion = self.currentRegion
self.partialFormatter.defaultRegion = self.currentRegion
self.updateFlag()
self.updatePlaceholder()
// but only when the withFlag is true as to not confuse the user who don't see the flag
if withFlag == true
{
self._defaultRegion = self.currentRegion
self.partialFormatter.defaultRegion = self.currentRegion
self.updateFlag()
self.updatePlaceholder()
}

return false
}
Expand Down

0 comments on commit 80acec2

Please sign in to comment.