https://kotlinlang.org logo
#compose
Title
# compose
o

oday

05/07/2022, 3:17 PM
I get an exception here about FocusRequester not being initialized
Copy code
val passwordRequester = remember { FocusRequester() }

        Card(
            modifier = Modifier
                .fillMaxWidth()
                .padding(horizontal = 32.dp),
            elevation = 4.dp
        ) {
            Column(
                modifier = Modifier.padding(16.dp),
                horizontalAlignment = Alignment.CenterHorizontally
            ) {
                EmailInput(
                    modifier = Modifier.fillMaxWidth(),
                    email = email,
                    onEmailChanged = onEmailChanged
                ) {
                     // HERE
                    passwordRequester.requestFocus()
                }

                Spacer(modifier = Modifier.height(16.dp))

                PasswordInput(
                    modifier = Modifier.focusRequester(passwordRequester),
                    password = password,
                    onPasswordChanged = onPasswordChanged,
                    onDoneClicked = onAuthenticate
                )
            }
        }
o

Oleksandr Balan

05/07/2022, 4:46 PM
Could you try to move the requester in the same scope where it is used? In this case inside the Column.
225 Views