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

fix: crash related to request focus when clicking on last name EditTe… #2190

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ private fun DetailsContent(
) {
val keyboardOptions = KeyboardOptions(KeyboardCapitalization.Words, true, KeyboardType.Text, ImeAction.Next)
val keyboardController = LocalSoftwareKeyboardController.current
val focusRequesterFirstName = remember { FocusRequester() }
val focusRequesterLastName = remember { FocusRequester() }
val focusRequesterTeamName = remember { FocusRequester() }
val firstNameFocusRequester = remember { FocusRequester() }

Column(
horizontalAlignment = Alignment.CenterHorizontally,
Expand All @@ -134,13 +132,6 @@ private fun DetailsContent(
.verticalScroll(rememberScrollState())
) {

val requestFocus = remember<(Offset) -> Unit> {
{ _ ->
keyboardController?.show()
focusRequesterTeamName.requestFocus()
}
}

Text(
text = stringResource(R.string.create_personal_account_details_text),
style = MaterialTheme.wireTypography.body01,
Expand All @@ -166,7 +157,7 @@ private fun DetailsContent(
end = MaterialTheme.wireDimensions.spacing16x,
bottom = MaterialTheme.wireDimensions.spacing16x
)
.focusRequester(focusRequesterFirstName)
.focusRequester(firstNameFocusRequester)
.testTag("firstName"),
)

Expand All @@ -184,10 +175,7 @@ private fun DetailsContent(
end = MaterialTheme.wireDimensions.spacing16x,
bottom = MaterialTheme.wireDimensions.spacing16x
)
.focusRequester(focusRequesterLastName)
.testTag("lastName"),
shouldDetectTaps = true,
onTap = requestFocus
)

if (state.type == CreateAccountFlowType.CreateTeam) {
Expand All @@ -205,10 +193,7 @@ private fun DetailsContent(
end = MaterialTheme.wireDimensions.spacing16x,
bottom = MaterialTheme.wireDimensions.spacing16x
)
.testTag("teamName")
.focusRequester(focusRequesterTeamName),
shouldDetectTaps = true,
onTap = requestFocus
.testTag("teamName"),
)
}

Expand All @@ -227,7 +212,6 @@ private fun DetailsContent(
WireTextFieldState.Default
},
autofill = false,
onTap = requestFocus
)

WirePasswordTextField(
Expand All @@ -251,12 +235,11 @@ private fun DetailsContent(
WireTextFieldState.Error(stringResource(id = R.string.create_account_details_password_error))
} else WireTextFieldState.Default,
autofill = false,
onTap = requestFocus
)
}

LaunchedEffect(Unit) {
focusRequesterFirstName.requestFocus()
firstNameFocusRequester.requestFocus()
keyboardController?.show()
}

Expand Down