Fix missing focus when single TextField shown (#8098)

This commit is contained in:
Ivan Iskandar 2022-09-28 04:44:06 +07:00 committed by GitHub
parent e2ce3f68bf
commit f19c288bec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View File

@ -70,7 +70,7 @@ fun CategoryRenameDialog(
category: Category,
) {
val (name, onNameChange) = remember { mutableStateOf(category.name) }
val focusRequester = remember { FocusRequester.Default }
val focusRequester = remember { FocusRequester() }
AlertDialog(
onDismissRequest = onDismissRequest,

View File

@ -41,7 +41,6 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import eu.kanade.tachiyomi.R
import kotlinx.coroutines.delay
@Composable
fun AppBar(
@ -225,7 +224,7 @@ fun SearchToolbar(
downloadedOnlyMode: Boolean = false,
scrollBehavior: TopAppBarScrollBehavior? = null,
) {
val focusRequester = remember { FocusRequester.Default }
val focusRequester = remember { FocusRequester() }
AppBar(
titleContent = {
BasicTextField(
@ -256,8 +255,6 @@ fun SearchToolbar(
scrollBehavior = scrollBehavior,
)
LaunchedEffect(focusRequester) {
// TODO: https://issuetracker.google.com/issues/204502668
delay(100)
focusRequester.requestFocus()
}
}