rememberPCIFieldState
Creates a new instance of PCIFieldState that is remembered across recompositions.
Important: This state is NOT preserved across process death or configuration changes (e.g., screen rotation). This is intentional for PCI DSS compliance — sensitive card data (card number, CVV, expiration date) must never be serialized to Bundle or disk.
To preserve state across configuration changes, host PCIFieldState in your ViewModel instead:
class PaymentViewModel : ViewModel() {
val cardNumberState = PCIFieldState.create()
val expirationDateState = PCIFieldState.create()
val securityCodeState = PCIFieldState.create()
}
@Composable
fun PaymentForm(viewModel: PaymentViewModel) {
CardNumberTextField(state = viewModel.cardNumberState)
ExpirationDateTextField(state = viewModel.expirationDateState)
}Content copied to clipboard
Return
A new PCIFieldState instance remembered for the current composition