rjrjr / compose-backstack

Simple composable for rendering transitions between backstacks.
Other
504 stars 23 forks source link

Fix 'save instance state' functionality #29

Closed grandstaish closed 4 years ago

grandstaish commented 4 years ago

Fixes #28

Most of this functionality is borrowed directly from how rememberSavedInstanceState works. Each screen now registers its own provider with its parent UiSavedStateRegistry. This means when compose-provided (topmost) registry saves, all of our child registries recursively save too. The rest of the implementation is identical, we still trigger save when a screen transitions offscreen, and restore that state when a screen comes back onscreen.

Happy to make any changes/improvements!

zach-klippenstein commented 4 years ago

Oops, should have merged this before deleting the old master branch, sorry.

zach-klippenstein commented 4 years ago

Sorry it took me so long to merge this, thanks! I'll do a release shortly.