fix types
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import {NavigationProp} from '@react-navigation/native'
|
import {NavigationProp} from '@react-navigation/native'
|
||||||
import {State, RouteParams} from './types'
|
|
||||||
|
import {RouteParams, State} from './types'
|
||||||
|
|
||||||
export function getRootNavigation<T extends {}>(
|
export function getRootNavigation<T extends {}>(
|
||||||
nav: NavigationProp<T>,
|
nav: NavigationProp<T>,
|
||||||
@@ -10,7 +11,11 @@ export function getRootNavigation<T extends {}>(
|
|||||||
return nav
|
return nav
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCurrentRoute(state: State) {
|
export function getCurrentRoute(state?: State) {
|
||||||
|
if (!state) {
|
||||||
|
return {name: ''}
|
||||||
|
}
|
||||||
|
|
||||||
let node = state.routes[state.index || 0]
|
let node = state.routes[state.index || 0]
|
||||||
while (node.state?.routes && typeof node.state?.index === 'number') {
|
while (node.state?.routes && typeof node.state?.index === 'number') {
|
||||||
node = node.state?.routes[node.state?.index]
|
node = node.state?.routes[node.state?.index]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {View} from 'react-native'
|
|||||||
import {AppBskyActorDefs} from '@atproto/api'
|
import {AppBskyActorDefs} from '@atproto/api'
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useNavigation} from '@react-navigation/native'
|
import {NavigationProp, useNavigation} from '@react-navigation/native'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {getRootNavigation, getTabState, TabState} from '#/lib/routes/helpers'
|
import {getRootNavigation, getTabState, TabState} from '#/lib/routes/helpers'
|
||||||
@@ -19,6 +19,7 @@ import {useSetMinimalShellMode} from '#/state/shell'
|
|||||||
import {useComposerControls} from '#/state/shell/composer'
|
import {useComposerControls} from '#/state/shell/composer'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
import {useAnalytics} from 'lib/analytics/analytics'
|
||||||
import {ComposeIcon2} from 'lib/icons'
|
import {ComposeIcon2} from 'lib/icons'
|
||||||
|
import {AllNavigatorParams} from 'lib/routes/types'
|
||||||
import {s} from 'lib/styles'
|
import {s} from 'lib/styles'
|
||||||
import {useHeaderOffset} from '#/components/hooks/useHeaderOffset'
|
import {useHeaderOffset} from '#/components/hooks/useHeaderOffset'
|
||||||
import {Feed} from '../posts/Feed'
|
import {Feed} from '../posts/Feed'
|
||||||
@@ -48,7 +49,7 @@ export function FeedPage({
|
|||||||
}) {
|
}) {
|
||||||
const {hasSession} = useSession()
|
const {hasSession} = useSession()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const navigation = useNavigation()
|
const navigation = useNavigation<NavigationProp<AllNavigatorParams>>()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const {openComposer} = useComposerControls()
|
const {openComposer} = useComposerControls()
|
||||||
const [isScrolledDown, setIsScrolledDown] = React.useState(false)
|
const [isScrolledDown, setIsScrolledDown] = React.useState(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user