Fix: correctly identify if the screen is focused when handling soft resets on post feeds (#2100)

This commit is contained in:
Paul Frazee
2023-12-05 18:01:08 -08:00
committed by GitHub
parent 3c8036587e
commit 826b841e10
4 changed files with 26 additions and 13 deletions
+10
View File
@@ -1,5 +1,15 @@
import {NavigationProp} from '@react-navigation/native'
import {State, RouteParams} from './types'
export function getRootNavigation<T>(
nav: NavigationProp<T>,
): NavigationProp<T> {
while (nav.getParent()) {
nav = nav.getParent()
}
return nav
}
export function getCurrentRoute(state: State) {
let node = state.routes[state.index || 0]
while (node.state?.routes && typeof node.state?.index === 'number') {