semoro04/11/2020, 4:22 AM
and provide some key? https://gist.github.com/semoro/ea7c07cf3bcbd3bc4cbc4729b82b4140#file-composeremovalarea-kt-L64 Actually, if I don’t provide some kind of this id parameter, button click also hides subsequent list element, which is a bit counter-intuitive. Is it due to that changes of input parameters in RemovalArea’s child doesn’t cause recompose in RemovalArea itself, and previously occupied slot for deleted element became used by next one, without reset of state? Is there is some way to avoid passing
Timo Drick04/11/2020, 12:32 PM
semoro04/11/2020, 1:08 PM
Zach Klippenstein (he/him) [MOD]04/11/2020, 2:04 PM
annotation to `RemoveArea`'s
parameter? That should mean you don't need
anymore, and should all preserve your other list items' state across list modifications (ie supports "moving" groups around). I think you need
for that reason, so compose can handle moves/reorders correctly.
semoro04/11/2020, 2:06 PM
Zach Klippenstein (he/him) [MOD]04/11/2020, 2:15 PM
is for, instead of just treating the removal as the composable parameters changing and reusing the slots/states from the deleted item, compose can see that they were actually removed, and the slots/state for the subsequent item in the list are effectively moved back up to fill the gap, preserving the state.
semoro04/11/2020, 2:17 PM
like parameters in such case?
Zach Klippenstein (he/him) [MOD]04/11/2020, 2:38 PM
here for the same reason RecyclerView does to correctly handle moves (
distinguishes between content changes and "item identity" changes) - the system needs to have some concept of "which" item an item is for the concept of "move" to even make sense.
composable make use of something like your
(they call it a
semoro04/11/2020, 2:44 PM
Zach Klippenstein (he/him) [MOD]04/11/2020, 2:49 PM
function which is just a convenience if you don't already have a custom composable wrapping your children.
semoro04/11/2020, 2:52 PM
and on removal of first item in list application hangs 😞 (ANR)
Zach Klippenstein (he/him) [MOD]04/11/2020, 2:55 PM
too actually but I wouldn't think they'd have different behavior 🤔
Zach Klippenstein (he/him) [MOD]04/11/2020, 3:48 PM