rememberPhoneNumberFieldState

fun rememberPhoneNumberFieldState(initialCountry: Country, initialNumber: String = "", enforceMaxLength: Boolean = true, allowedNumberTypes: Set<PhoneNumberType> = emptySet()): PhoneNumberFieldState(source)

Remembers a PhoneNumberFieldState, restoring the country and digits across configuration change and process death.

Parameters

initialCountry

Starting country. Falls back to the first dataset entry if the code is unknown.

initialNumber

Starting number; may be E.164, in which case the country is taken from it.

enforceMaxLength

Cap input at the region's maximum length.

allowedNumberTypes

Line types the field accepts, or empty for any. Pass PhoneNumberType.SmsCapable for a one-time-code flow.