rememberVgsExpiryTextFieldState

fun rememberVgsExpiryTextFieldState(collect: VGSCollect, fieldName: String, validators: List<VgsTextFieldValidator>? = null, inputDateFormat: VgsExpiryDateFormat = VgsExpiryDateFormat.MonthShortYear, outputDateFormat: VgsExpiryDateFormat = VgsExpiryDateFormat.MonthShortYear, serializer: VgsExpirySerializer? = null, tokenizationConfig: VgsExpiryTokenizationConfig? = null): MutableState<VgsExpiryTextFieldState>

Creates and remembers a VgsExpiryTextFieldState for use with a VgsExpiryTextField. This is the only way to obtain an instance — direct construction is internal to the SDK.

var state by rememberVgsExpiryTextFieldState(
collect = vgsCollect,
fieldName = "data.expiry",
)

Parameters

collect

the VGSCollect instance the field is bound to.

fieldName

JSON key the value will be sent under by VGSCollect.asyncSubmit.

validators

custom validators. If null, default required + min/max date validation applies. Pass emptyList() to disable validation.

inputDateFormat

the format the user types in. Defaults to VgsExpiryDateFormat.MonthShortYear (MM/YY).

outputDateFormat

the format used on submit. Defaults to VgsExpiryDateFormat.MonthShortYear (MM/YY).

serializer

optional; splits the date into separate month/year JSON fields on submit.

tokenizationConfig

optional; when set, the value is tokenized on submit and the token is sent in place of the raw value.