Page MenuHomePhabricator

[native] Add community drawer to navigation hierarchy
ClosedPublic

Authored by inka on Nov 28 2022, 6:09 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 9, 11:03 PM
Unknown Object (File)
Thu, Nov 7, 5:43 AM
Unknown Object (File)
Mon, Nov 4, 3:47 PM
Unknown Object (File)
Mon, Nov 4, 3:47 PM
Unknown Object (File)
Mon, Nov 4, 3:47 PM
Unknown Object (File)
Wed, Oct 30, 11:12 AM
Unknown Object (File)
Mon, Oct 28, 7:19 AM
Unknown Object (File)
Oct 8 2024, 4:46 AM
Subscribers

Details

Summary

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.

Test Plan

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
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

inka requested review of this revision.Nov 28 2022, 6:23 AM

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.

ashoat requested changes to this revision.Nov 28 2022, 9:56 AM

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

This revision now requires changes to proceed.Nov 28 2022, 9:56 AM
native/navigation/tab-navigator.react.js
70 ↗(On Diff #18946)

I believe this was incorrect in the first place, and that was my fault.

native/navigation/tab-navigator.react.js
70 ↗(On Diff #18946)

Good call – should've caught this in review!

ashoat added 1 blocking reviewer(s): tomek.

Would love if @tomek could take a look as well (or at least one other person)

native/navigation/community-drawer-navigator.react.js
46 ↗(On Diff #18946)

This should be in a React.useMemo

tomek added inline comments.
native/navigation/nav-selectors.js
162–172 ↗(On Diff #18946)

It seems like we're duplicating most of this logic. It might be a good idea to refactor it later by extracting a function.

This revision is now accepted and ready to land.Nov 30 2022, 8:35 AM
native/navigation/nav-selectors.js
162–172 ↗(On Diff #18946)

Created a linear issue for this.

Changes due to changes in previous piff