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

Maintaining Screen State on Backstack? #200

Open
ScottPierce opened this issue Jan 27, 2017 · 6 comments
Open

Maintaining Screen State on Backstack? #200

ScottPierce opened this issue Jan 27, 2017 · 6 comments

Comments

@ScottPierce
Copy link

We're using flow and mortar, and looking to save some data on a screen that when we come back to it on the backstack can be used to restore some state.

How would you recommend we do this?

@ScottPierce ScottPierce changed the title Maintaining View State on Backstack? Maintaining Screen State on Backstack? Jan 27, 2017
@ScottPierce
Copy link
Author

@rjrjr ?

@Zhuinden
Copy link

Zhuinden commented Feb 7, 2017

@ScottPierce my recommendation is to throw Mortar ViewPresenters out and use Flow's KeyManager exclusively.

@ScottPierce
Copy link
Author

@Zhuinden My team has screens within screens sometimes, which is why we added in Mortar to our Flow usage. I'm assuming that KeyManagers doesn't allow for that, right?

@Zhuinden
Copy link

Zhuinden commented Feb 7, 2017

KeyManager allows you to put any state into the history entry. It just associates history entries with keys.

Personally when I had multiple views that could persist state, my root view delegated the "state persistence callback" to the ones inside itself. A bit manual, but it worked.

@ScottPierce
Copy link
Author

@Zhuinden thanks for the recommendation. I'll look into it and close this if it works.

I'm actually not seeing any documentation for it anywhere in the flow repo. Do you know of where I could see an example of it working?

@Zhuinden
Copy link

Zhuinden commented Feb 7, 2017

I think the key manager's state is exposed via Traversal.getState(Key) in the original Flow.

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

2 participants