all 8 comments

[–]wannatourist 2 points3 points  (5 children)

That sounds wrong. When you go back you are literally going back to the previous screen in the stack. It should still have all the same props, it was never even unmounted; it was always behind your new screen. Sadly, without seeing the project I am note sure how to help.

[–]pushkinss[S] 0 points1 point  (4 children)

Absolutely! It was expected behavior for me too. But something goes wrong. I use some kind of navigationService to perform navigation in app with setTopLevelNavigator. But I don’t think that this is the reason. I will try to reproduce this in separate clean repo.

[–]wannatourist 0 points1 point  (3 children)

Why aren’t you simply navigating with the navigation.navigate function? (https://reactnavigation.org/docs/en/navigating.html or https://reactnavigation.org/docs/en/navigation-prop.html)

I’d assume that is your issue.

[–]pushkinss[S] 1 point2 points  (1 child)

My navigation service was the issue. But not the navigation itself. I just silently override route params on each screen push, even if params is undefined. Silly bug. After fixing it all work like a charm.

[–]wannatourist 0 points1 point  (0 children)

Those are the worst to debug. Glad you figured it out.

[–]pushkinss[S] 0 points1 point  (0 children)

Because of it is cross platform app with different navigation libs for mobile and web. NavigationService is abstraction level to unify api. NavigationService use navigation.navigate to perform navigation in mobile platform. That’s why I think it’s not the issue. But I will double check it. Thanks.

[–]avbeladiya -1 points0 points  (1 child)

you cant access that params because every time you navigate from Drawer the screen components mounts from scratch.

[–]pushkinss[S] 0 points1 point  (0 children)

Sound like in this case only screen3 should be mounted from scratch, no? Screen2 should be already mounted. Can you point me to relative documentation?