I’ve seen a few questions here around autofill wit...
# compose
b
I’ve seen a few questions here around autofill with Compose, so I wrote a post on it: https://bryanherbst.com/2021/04/13/compose-autofill/
jetpack compose 7
👏🏼 1
🚀 9
👏🏿 1
♥️ 8
👏 15
d
Hey, there, I've seen the official example and your article here that move it to a modifier. I've also read this comment from Ralson Da Silva about what they think the API will look like. I've the say the current API looks a bit unreliable, sometimes it will autocomplete and sometimes it wont. For instance I've a form to edit user profile where I marked FirstPersonName etc that don't get autocompleted.
ah sorry, message sent before I finished. Username / password are autocompleted but when I perform a login it doesn't propose to save those. I'm also kind of puzzled by the demo example:
Copy code
val autofillNode = AutofillNode(onFill = onFill, autofillTypes = autofillTypes)
why isn't this in a remember?
Copy code
val autofillTree = LocalAutofillTree.current
autofillTree += autofillNode
shouldn't this be in some kind of side effect? (ex. DisposableEffect / LaunchedEffect)
b
why isn’t this in a remember?
You could, but you don’t need to (there’s no state there) and in practice I suspect you won’t get much in terms of any sort of performance improvement either since the
onFill
lambda won’t be stable.
shouldn’t this be in some kind of side effect? (ex. DisposableEffect / LaunchedEffect)
Maybe? See above with respect to
onFill
- I haven’t experimented with lambdas as a key to an effect, but you need to make sure to create a new node whenever the parameters change. I see where you are going though - we never remove old nodes from the tree. I took the guts of that modifier from the AndroidX sample, so I don’t have all the answers there.
Username / password are autocompleted but when I perform a login it doesn’t propose to save those.
I’ve been encouraging folks to file bugs like this on the issue tracker - I’ve heard this frequently enough that it is obvious there are some issues here that Google needs to address. There are a few open issues that you could chime in on, or open your own: • https://issuetracker.google.com/issues/176949051https://issuetracker.google.com/issues/237190742 And it looks like there’s some internal nudging to make progress on these APIs: https://issuetracker.google.com/issues/261422380
d
Thank you, I recently created a new thread about this which has been ignored so far: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1670232070727109 Would you mind chime in to help nudging googlers on this? I'll try to comment the last bug you linked asking to not remove and instead improve the API
b
Unfortunately I don’t have any relationships with Googlers that I could leverage here - chiming in on the issue tracker is probably the best way to signal community desire for better support
103 Views