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

Bradleycorn

09/09/2021, 3:15 PM
is there a way to focus a composable (specifically a TextField) in a
@Preview
? I tried adding a focus requester and requesting focus in a DisposableEffect, but as I suspected, no luck.
c

Chris Johnson

09/10/2021, 4:17 AM
Try
LaunchedEffect
for focusing.
DisposableEffect
doesn't give the composable enough time to layout before it requests focus.
LaunchedEffect
should.
b

Bradleycorn

09/10/2021, 8:00 PM
@Chris Johnson - Thanks, but Launched Effect doesn’t seem to work either.
c

Chris Johnson

09/10/2021, 8:13 PM
Must be a Preview specific thing. 😞 LaunchedEffect does work for me in a regular composable.