Drawer Navigation, Navigation Stack Refactor, and Nav Header Branding#1137
Drawer Navigation, Navigation Stack Refactor, and Nav Header Branding#1137kevinherdez wants to merge 2 commits intoNWACus:kevinherdez/mapProjectfrom
Conversation
what is the reason to have DrawerNavigator not be same level as the MainStackNavigator? reading about navigation depth and stuff, less levels means less complexity so just trying to understand the reason for the hierarchy that my monday 9 pm brian may very well be missing. |
I reworked the stack to try to combine However, what I could do is remove the need for Pros:
Cons:
|
Addressed PR feedback
86a09bc to
50deecf
Compare
routes.ts
Outdated
| requestedTime: RequestedTimeString; | ||
| }; | ||
| export type MainStackParamList = { | ||
| bottomTabs: TabNavigationProps; |
There was a problem hiding this comment.
copilot tells me this should be to ensure type=safe nested navigation:
bottomTabs: NavigatorScreenParams<TabNavigatorParamList> | undefined;
There was a problem hiding this comment.
its explanation: If nobody is doing nested navigate() calls across these boundaries (which seems likely given the architecture), the wrong types are mostly harmless at runtime — React Navigation doesn't actually type-check params at runtime. But it undermines the purpose of typing the param lists in the first place, and could cause confusing IDE suggestions.
There was a problem hiding this comment.
Oh nice I didn't know that. I'll make the changes for all of these.
There was a problem hiding this comment.
let me know if you made the change and it didnt propagate or if you did and something broke 😄
You mean like if someone clicks About and then clicks back - should this close the drawer? I dont see the jittery-ness but I must admit I have not loaded the app on my phone to play with so I trust you if you say it feels like a weird experience. This could be a question for design - maybe they can help chime in on what makes more sense. A few thoughts:
I started thinking about this because I noticed both MainStack and RootStack define the same screens (forecast, observation, nwacObservation) and got a bit confused about why we need two layers. Since zooming into a center on the map changes your default center, won't MainStack and RootStack always end up showing the same center anyway? If there's no need for the overlay behavior, could we consolidate to just the MainStack versions (and I guess thats another navigation tree simplification) Let me know if I am making sense...I feel like I have overthought this and my brain is not computing 😆 |
For 1: I think breaking the Dev menu out to its own view makes the most sense and maybe leaving the access point in the drawer would be good. At least for now because I can't really think of where to put that button. For 2: That's a really great call out that I honestly didn't think about. I'll look into the deep linking setup to make sure we're not about to create more work by setting up the stack wrong, and I think that should dictate what we do here. There reason that there are duplicate views defined in I think I'm being picky about the "jitteriness" I mentioned earlier. I think I just noticed how it was difference and probably not actually a problem |
|
It seems like for deep linking it all comes down to how the config is set up. I think consolidating everything into either |
|
Here is the experience for moving the dev menu in a screen. There are currently some issues with it that I'm tracking here as a fast follow #1117 |
bfcd51c to
24c6d5b
Compare
yuliadub
left a comment
There was a problem hiding this comment.
looks awesome! thanks for all your work on this!
2 things but im signing off:
- This is claude suggestion given the new navigation stack:
The ObservationForm.tsx comment says "SafeAreaView shouldn't inset from bottom edge because TabNavigator is sitting there" — but in the new structure, [observationSubmit] lives in MainStack, not inside BottomTabs. There's no bottom tab below the observation form anymore, so the bottom content will render behind the device's home indicator. The bottom edge should likely be added:
The same logic applies to any screen that moved from inside the old per-tab stack navigators to MainStack (observation detail views, weather station details, forecast screen). Each of these has SafeAreaView configs that were tuned for the old hierarchy. Worth a quick audit of all moved screens.
- I meant to comment about this last time but forgot, but do we still need nwacObservation? i know for a while NWAC obs were not on the NAC but I thought they have all moved there. Maybe worth just flagging as an issue, in no way a blocker for this PR




This PR address the following issues:
Overview
This pulls in
@react-navigation/drawerto move theMenuin the drawer, and refactors the navigation stack to correctly hide the bottom tab in the views where it needs to be hidden according to the designs.Where to Start
App.tsxDrawer.tsxRefactor
The screen definitions that use to be in
ObservationsScreen.tsxandWeatherScreen.tsxhave been moved intoMainStack.tsxNavigation Stack Overview and Refactor
To achieve the behavior we want there are now 3 levels to the Navigation Stack
DrawerNavigator|
MainStackNavigator|
BottomTabNavigatorDrawerNavigator
This only contains the
MainStackNavigatoras its main screen and it contains the UI for the drawer itself.MainStackNavigator
This contains the
BottomTabsand any screen that is presented as a part of the "main" app experience. This moves a lot of views like theForecastScreen,ObservationDetailScreen, etc out of the bottom tab navigator so that the bottom tabs are not shown in these views. This also contains views that are navigated to from the drawer itself like theAboutScreenand theAvalancheCenterSelector. This is the based on React Navigation docs as best way to hide the bottom tab in views: https://reactnavigation.org/docs/hiding-tabbar-in-screens/BottomTabs
This is the old TabNavigator that was in App.tsx. However, the
HomeTabScreen,ObservationsTabScreen, and theWeatherScreenhave all been refactored to remove their own navigation stack.BottomTabsnow only has 3 screens, none of which are their own stack navigators.Design changes
Navigation Headers
BottomTabNavigationHeaderwas created for use in the 3 screens contained inBottomTabs. This is because theheaderdefinition inBottomTab.NavigatorpassesBottomTabHeaderPropsinstead ofNativeStackHeaderProps. For simplicity, I broke out the different headers into 2 different components instead of trying to combine them into 1.Branding
BottomTabNavigationHeaderdisplays the branding for the center. Currently, that is just the logo with the acronym and no special colorsForecastScreen
This PR removes the ability to change zones when viewing the full avalanche forecast as per designs
SafeArea
Many of the views that were a part of
BottomTabsneeded to be updated to have the correct bottom padding now that they no longer have a bottom tabRecording with the changes in action
StackRework.mov