From 10621e86e4379ff05b2262a659b8512d80203a4b Mon Sep 17 00:00:00 2001 From: Ansh Date: Tue, 18 Apr 2023 09:19:37 -0700 Subject: APP-70 give profile its own tab mobile (#469) * add prebuild command to package.json * add ProfileTab navigator and screen * add prop to remove back button from profile * fix MyProfileTabNavigatorParams type * fix dep array for rendering ProfileHeader * just added ts-ignore * enable opening drawer in profile tab * clean up useNavigationTabState * clean up code * fix hideBackButton code flow --- src/lib/hooks/useNavigationTabState.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/lib/hooks/useNavigationTabState.ts') diff --git a/src/lib/hooks/useNavigationTabState.ts b/src/lib/hooks/useNavigationTabState.ts index 8afc799eb..fb3662152 100644 --- a/src/lib/hooks/useNavigationTabState.ts +++ b/src/lib/hooks/useNavigationTabState.ts @@ -3,11 +3,24 @@ import {getTabState, TabState} from 'lib/routes/helpers' export function useNavigationTabState() { return useNavigationState(state => { - return { + const res = { isAtHome: getTabState(state, 'Home') !== TabState.Outside, isAtSearch: getTabState(state, 'Search') !== TabState.Outside, isAtNotifications: getTabState(state, 'Notifications') !== TabState.Outside, + isAtMyProfile: getTabState(state, 'MyProfile') !== TabState.Outside, } + if ( + !res.isAtHome && + !res.isAtNotifications && + !res.isAtSearch && + !res.isAtMyProfile + ) { + // HACK for some reason useNavigationState will give us pre-hydration results + // and not update after, so we force isAtHome if all came back false + // -prf + res.isAtHome = true + } + return res }) } -- cgit 1.4.1