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

Screen State not getting retained #372

Open
techjd opened this issue Mar 22, 2024 · 2 comments
Open

Screen State not getting retained #372

techjd opened this issue Mar 22, 2024 · 2 comments

Comments

@techjd
Copy link

techjd commented Mar 22, 2024

I am working on a project with 5 tabs. I have a Home tab, which displays a list of products. Clicking on any product takes you to the detail page. Initially, my problem was in navigating to the detail screen. It works perfectly with nested navigation, but I wanted to hide the bottom nav bar and top app bar.

Initially, I followed the approach mentioned in this discussion thread: #322.

It did work, but I had to pass lambda as a parameter to the screen, which caused crashes on Android due to java.lang.RuntimeException: Parcelable encountered IOException writing serializable object.

I quickly changed my approach and navigated to the DetailedScreen using the parent navigator: #204 (comment).

However, I am facing an issue where the screen state is not retained when navigating back on Android, although on iOS, the screen state is retained. This problem is also faced in rest of the tabs. Are there any fixes for this?

You can observe in the video that the list state is getting changed on Android. My current approach can be found here

problem.mp4
@techjd techjd changed the title Screen State not getting reatined Screen State not getting retained Mar 22, 2024
@nvkleban
Copy link
Contributor

nvkleban commented Apr 7, 2024

Have you tried setting disposeNestedNavigators = false in the root navigator?

@DevSrSouza
Copy link
Collaborator

All Voyager screen has to be serializable in a Bundle, this means that you need to all parameters of your Screen for Android to be or Java Serializable or Parcelable.

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

No branches or pull requests

3 participants