Skip to content

Commit

Permalink
Clear keyboard when closing address element (#5469)
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswoo-stripe committed Aug 26, 2022
1 parent d6be9b7 commit 329a17b
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
Expand All @@ -34,14 +35,19 @@ internal fun InputAddressScreen(
formContent: @Composable ColumnScope.() -> Unit,
checkboxContent: @Composable ColumnScope.() -> Unit
) {
val focusManager = LocalFocusManager.current

ScrollableColumn(
modifier = Modifier
.fillMaxHeight()
.background(MaterialTheme.colors.surface)
) {
AddressOptionsAppBar(
isRootScreen = true,
onButtonClick = { onCloseClick() }
onButtonClick = {
focusManager.clearFocus()
onCloseClick()
}
)
Column(
Modifier
Expand All @@ -58,6 +64,7 @@ internal fun InputAddressScreen(
isEnabled = primaryButtonEnabled,
text = primaryButtonText
) {
focusManager.clearFocus()
onPrimaryButtonClick()
}
}
Expand Down

0 comments on commit 329a17b

Please sign in to comment.