Hello!
I want to set focus on input and show a keyboard when the screen is showed. I want to implement this behavior on a number of screens and I want to reduce code duplication with FocusRequester and LaunchedEffect.
Is it correct to create requestFocus modifier like this?
That looks correct, yes. Whether it’s a pattern that will get you into trouble as you scale, idk. But I’d probably give it a more descriptive name at the very least (eg
requestFocusImmediately
)
s
Sergey Zarochentsev
09/17/2021, 5:11 PM
@Zach Klippenstein (he/him) [MOD] thanks for your feedback!