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 · 1 comment
Open

Credit Card Validator #64

stevdza-san opened this issue Aug 24, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

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")
        }
    }```
@bernard-ng bernard-ng added the bug Something isn't working label Jan 17, 2025
@bernard-ng
Copy link
Member

Hey @stevdza-san sorry for the late response, did you find any solution ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants