Linear issue: https://linear.app/comm/issue/ENG-1881/community-navigation-drawer-on-native and https://linear.app/comm/issue/ENG-2327/change-code-around-getstatefromnavigatorroute-to-address-adding-drawer
Adding the drawer navigator between App and Tab navigators so it opens over the tabs. Some calls to getStateFromNavigatorRoute had to be changed as they assumed the navigation hierarchy. The dafault
state had to be updated to relfect the new hierarchy.
Details
Checked the changes to activeThread by logging the value it returns, and the changes to baseCreateActiveTabSelector by logging the value returnes in ProfileHeader depending on the navigation state.
Run the ios simulator and checked that the drawer can be opened from the TabNavigator header and the drawer behaves as expected: CommunityDrawerContent is displayed, navigation to threads works, etc.
Diff Detail
- Repository
- rCOMM Comm
- Branch
- inka/community_drawer
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
getStateFromNavigatorRoute is called from nav-selectors.js: baseCreateActiveTabSelector, scrollBlockingModalsClosedSelector, selectBackgroundIsDark and activeThread. scrollBlockingModalsClosedSelector and selectBackgroundIsDark look at scrollBlockingModals that are children of App component.TabNavigator is not one of them, and neither is DrawerNavigator so the changes don't influence the behaviour.
The code in the other two functions has been changed and tested as described in the revision.
getStateFromNavigatorRoute is called from navigation-utils.js: currentRouteRecurse, getChildRouteFromNavigatorRoute. None of these require any changes.
getStateFromNavigatorRoute is called from thread-screen-pruner.react.js: https://github.com/CommE2E/comm/blob/master/native/chat/thread-screen-pruner.react.js#L52. The code around this has been changed in this diff.
Great work spotting all of these places that need to be updated!!
That said, I'm pretty sure TabNavigator needs to be updated now since its types are probably wrong now
native/navigation/tab-navigator.react.js | ||
---|---|---|
70 | I believe this was incorrect in the first place, and that was my fault. |
native/navigation/tab-navigator.react.js | ||
---|---|---|
70 | Good call – should've caught this in review! |
native/navigation/nav-selectors.js | ||
---|---|---|
162–172 | It seems like we're duplicating most of this logic. It might be a good idea to refactor it later by extracting a function. |
native/navigation/nav-selectors.js | ||
---|---|---|
162–172 | Created a linear issue for this. |