Hi, I'm trying to request focus on a textfield, it...
# compose-ios
i
Hi, I'm trying to request focus on a textfield, it works well on Android but on iOS the textfield doesn't get focused. Does this look correct or am I missing something for iOS:
Copy code
val focusRequester = remember { FocusRequester() }
 
 LaunchedEffect(Unit) {
     focusRequester.requestFocus()
 }
 Row(
     modifier = modifier.fillMaxWidth()
 ) {
     OutlinedTextField(
         modifier = Modifier.fillMaxWidth().focusRequester(focusRequester),
         value = state.value.searchQuery,
         onValueChange = {
             viewModel.onSearchQueryChange(it)
         },
         singleLine = true,
     )
 }
TIA!
Have tried that as well
a
The code you provided works fine. It looks like some context is missing. I would recommend to create a reproducer and file an issue at https://github.com/JetBrains/compose-multiplatform
Btw, if you're new to iOS development, and you can see that cursor in text field is blinking, try to press Cmd+Shift+K several times in iOS simulator.