Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Item selection does not persist through configuration changes on Android #117

Open
JonatanPlesko opened this issue Jan 11, 2024 · 1 comment

Comments

@JonatanPlesko
Copy link

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant