Skip to content

Commit

Permalink
Merge pull request android#186 from android/fm/pass_validation
Browse files Browse the repository at this point in the history
[Jetsurvey] Password validation errors fixed
  • Loading branch information
florina-muntenescu authored Sep 22, 2020
2 parents 7293cdc + b5d306a commit aca46a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fun SignInContent(
Button(
onClick = { onSignInSubmitted(emailState.text, passwordState.text) },
modifier = Modifier.fillMaxWidth().padding(vertical = 16.dp),
enabled = emailState.isValid
enabled = emailState.isValid && passwordState.isValid
) {
Text(
text = stringResource(id = R.string.sign_in)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ fun Email(
emailState.getError()?.let { error -> TextFieldError(textError = error) }
}

@OptIn(ExperimentalFocus::class)
@Composable
fun Password(
label: String,
Expand All @@ -160,7 +161,13 @@ fun Password(
passwordState.text = it
passwordState.enableShowErrors()
},
modifier = modifier.fillMaxWidth(),
modifier = modifier.fillMaxWidth().focusObserver { focusState ->
val focused = focusState == FocusState.Active
passwordState.onFocusChange(focused)
if (!focused) {
passwordState.enableShowErrors()
}
},
textStyle = MaterialTheme.typography.body2,
label = {
ProvideEmphasis(emphasis = EmphasisAmbient.current.medium) {
Expand Down

0 comments on commit aca46a3

Please sign in to comment.