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:
Hailey 2024-05-28 18:38:52 -07:00 committed by GitHub
parent 888bec7b4f
commit 8f8af476cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 43 additions and 103 deletions

View file

@ -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]