I have a LazyColumn which have items that contain ...
# compose-android
b
I have a LazyColumn which have items that contain TextFields, my list can be sorted, or items can be added to the list. I'm running into an issue where one of my items textfields is focused, then I sort the list in the opposite direction and the item that ends up in the focused items position is the one that has it's field focused. Similarly if I have the bottom most item focused and add a new item that with the sort would go above the bottom most item, the new item is the one that is focused. Any ideas? See attached for video demonstrating behavior.
Notice how when I sort the items, the top item is the one that has focus the entire time even though the actual item is changing.
👀 1
z
Are you using keys for the list?
b
Ah, I wasn't. My items didn't have a id from the API, but they should be unique in terms of every one of the properties should be unique together, I tried mapping all the fields to a set and that seems to work.
👍🏻 1