bsky-app/src/lib/hooks/useNavigationTabState.web.ts
Ansh 10621e86e4
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
2023-04-18 11:19:37 -05:00

14 lines
483 B
TypeScript

import {useNavigationState} from '@react-navigation/native'
import {getCurrentRoute} from 'lib/routes/helpers'
export function useNavigationTabState() {
return useNavigationState(state => {
let currentRoute = state ? getCurrentRoute(state).name : 'Home'
return {
isAtHome: currentRoute === 'Home',
isAtSearch: currentRoute === 'Search',
isAtNotifications: currentRoute === 'Notifications',
isAtMyProfile: currentRoute === 'MyProfile',
}
})
}