iPhoneNumberField("(000) 000-0000", text: $phoneNumber) { phoneNumberTextField in
phoneNumberTextField.keyboardType = .numberPad
}
.font(.systemFont(ofSize: 24))
.flagSelectable(false)
.flagHidden(false)
.defaultRegion("US")
.maximumDigits(10)
.formatted(false) // This makes phoneNumber is either valid or "".
.prefixHidden(false)
.clearsOnEditingBegan(false)
.clearsOnInsert(false)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding()
.disabled(actionInProgress)
.focused($phoneNumberIsFocused)
.onAppear {
phoneNumberIsFocused = true
}
.padding(.horizontal, 72)
It has been working well for my signups but today I had someone from Los Angeles with a (310) area code. For some reason the textfield resets itself to 0 after the 7th number is inputted as can be seen in video below. I tried with a number of different area codes and couldn't reproduce with any other area code except (310).
I have used
iPhoneNumberField
like shown below:It has been working well for my signups but today I had someone from Los Angeles with a (310) area code. For some reason the textfield resets itself to 0 after the 7th number is inputted as can be seen in video below. I tried with a number of different area codes and couldn't reproduce with any other area code except (310).
https://github.com/user-attachments/assets/bd028d9f-e8c2-433c-8180-c699a1eb54af