I'm using `Modifier.selectable(...)` and when the ...
# compose
d
I'm using
Modifier.selectable(...)
and when the composable is clicked, the animation plays and UI is updated, but the composable doesn't stay selected (graphically speaking). Do I have to change the background colour myself?
m
yes, you need to update the background color in according to your state. The selectable modifier just provides the callbacks and sets the accessibility/debug properties
d
It's a little weird that the background colour changes for the animation though.
Like I should also had to do that myself, which is why I was confused.
m
can you share a code snippet?
This is what it looks like. The list on the left. https://kotlinlang.slack.com/archives/C01D6HTPATV/p1614370237130400
m
You should use
selectedRoom == room.id
to define the UI. The composable reflects the state and you are the owner of that state