Item selection does not persist through configuration changes on Android
Opened this issue · 1 comments
JonatanPlesko commented
As described in the title, if the user selects some items and the activity gets recreated (e.g., due screen rotation), the item selection does not persist. This is easily reproducible with the sample app in the repository, you just need to select some items and rotate your device - the selection will be gone.
The original gist uses rememberSaveable
to avoid this issue.
JonatanPlesko commented
I expect replacing the return remember(lazyGridState)
with rememberSaveable
in DragSelectState#rememberDragSelectState would fix the issue. Unfortunately, the DragSelectState
class contains types that are not storeable inside the Bundle, so a custom Saver has to be implemented and passed to rememberSaveable
.