Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credit Card Validator #64

Open
stevdza-san opened this issue Aug 24, 2024 · 0 comments
Open

Credit Card Validator #64

stevdza-san opened this issue Aug 24, 2024 · 0 comments

Comments

@stevdza-san
Copy link

Hey good library. :)

I've just tried it out and found an issue with a credit card validator. It doesn't update the text field value, and I can't type anything in it. Other validators work fine. Here's the sample code:

    val creditCard = CardSchemeValidable(CardScheme.MasterCard)
    val validator = rememberValidator(emailField, creditCard)

    LaunchedEffect(Unit) {
        validator.validate {  }
    }

    Column(
        modifier = Modifier
            .fillMaxSize()
            .padding(horizontal = 24.dp)
            .verticalScroll(rememberScrollState()),
        verticalArrangement = Arrangement.Center,
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        OutlinedTextField(
            shape = RoundedCornerShape(12.dp),
            label = { Text(text = "Credit Card") },
            value = creditCard.value,
            onValueChange = { creditCard.value = it },
            isError = creditCard.hasError(),
            modifier = Modifier.fillMaxWidth()
        )
        Spacer(modifier = Modifier.height(8.dp))
        AnimatedVisibility(visible = creditCard.hasError()) {
            TextFieldError(textError = creditCard.errorMessage ?: "")
        }
        Spacer(modifier = Modifier.height(24.dp))
        Button(
            modifier = Modifier.fillMaxWidth(),
            enabled = !creditCard.hasError(),
            onClick = { }
        ) {
            Text(text = "Validate")
        }
    }```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant