fix: Title field doesn't get auto focused on screen launch

This commit is contained in:
Artem Chepurnoy 2024-04-11 11:45:29 +03:00
parent 0a2a69461f
commit 7426080808
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
1 changed files with 2 additions and 1 deletions

View File

@ -6,8 +6,8 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.focus.FocusRequester
import com.artemchep.keyguard.ui.focus.FocusRequester2
import kotlinx.coroutines.delay
class AddScreenScope(
initialFocusRequested: Boolean = false,
@ -22,6 +22,7 @@ class AddScreenScope(
LaunchedEffect(focusRequester) {
var initialFocusRequested by initialFocusRequestedState
if (!initialFocusRequested) {
delay(100L)
focusRequester.requestFocus()
// do not request it the second time
initialFocusRequested = true