I’ve yet to find a good approach / answer to this question and figured the place that I learned the building blocks to my knowledge would be a good start. Essentially I have a lot of screens… These screens vary between normal screens and within nested navigators. But I’m starting to notice that I am getting into a spaghetti of nested screens within my app.
Let’s use the common “ViewProfileScreen” screen. This is added across multiple navigators: HomeNavigator (navigating from thumbnail of post on the home screen), ExploreNavigator (navigating from a drop down on the search screen), and MyProfileScreen.
Currently HomeNavigator and ExploreNavigator both have “ViewProfileScreen” within each navigator. But when I click the thumbnail of a comment from a post on MyProfileScreen, I navigate from MyProfileScreen to “ViewProfileScreen” in another Navigator (since I have not explicitly added a Screen to the MyProfileScreen navigator). When I gesture swipe back (not click the goBack()), it takes me to the parent screen in the new navigator. It does not take me back to the MyProfileScreen that I navigated from. I understand this is the intended design, but becomes frustrating when a user just wanted to go back.
I feels not organized to have every screen within a singular AppNavigator file (as I have many screens). What would the best approach be for a large production scale app with >40 different screens. Do I start looking into Deep Links? Do I prevent the swipe back gesture and implement my own gesture logic for “goBack()”? I’m open to thoughts!