Bump react-navigation
(#4216)
* bump and rm patch * fix types * use `Home` default --------- Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
This commit is contained in:
parent
888bec7b4f
commit
8f8af476cc
6 changed files with 43 additions and 103 deletions
|
@ -1,5 +1,6 @@
|
|||
import {NavigationProp} from '@react-navigation/native'
|
||||
import {State, RouteParams} from './types'
|
||||
|
||||
import {RouteParams, State} from './types'
|
||||
|
||||
export function getRootNavigation<T extends {}>(
|
||||
nav: NavigationProp<T>,
|
||||
|
@ -10,7 +11,11 @@ export function getRootNavigation<T extends {}>(
|
|||
return nav
|
||||
}
|
||||
|
||||
export function getCurrentRoute(state: State) {
|
||||
export function getCurrentRoute(state?: State) {
|
||||
if (!state) {
|
||||
return {name: 'Home'}
|
||||
}
|
||||
|
||||
let node = state.routes[state.index || 0]
|
||||
while (node.state?.routes && typeof node.state?.index === 'number') {
|
||||
node = node.state?.routes[node.state?.index]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue