about summary refs log tree commit diff
path: root/src/lib/hooks/useNavigationTabState.web.ts
blob: d0173aa0f1e170eada50e52c82cb5c5e1984b2b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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',
    }
  })
}