diff --git a/native/flow-typed/npm/@react-navigation/core_v6.x.x.js b/native/flow-typed/npm/@react-navigation/core_v6.x.x.js --- a/native/flow-typed/npm/@react-navigation/core_v6.x.x.js +++ b/native/flow-typed/npm/@react-navigation/core_v6.x.x.js @@ -2152,6 +2152,11 @@ +independent?: boolean, |}; + declare export type UnsafeContainerActionEvent = {| + +action: GenericNavigationAction, + +noop: boolean, + |}; + declare export type ContainerEventMap = {| ...GlobalEventMap, +options: {| @@ -2159,10 +2164,7 @@ +canPreventDefault: false, |}, +__unsafe_action__: {| - +data: {| - +action: GenericNavigationAction, - +noop: boolean, - |}, + +data: UnsafeContainerActionEvent, +canPreventDefault: false, |}, |}; diff --git a/native/root.react.js b/native/root.react.js --- a/native/root.react.js +++ b/native/root.react.js @@ -3,7 +3,10 @@ import { ActionSheetProvider } from '@expo/react-native-action-sheet'; import { BottomSheetModalProvider } from '@gorhom/bottom-sheet'; import AsyncStorage from '@react-native-async-storage/async-storage'; -import type { PossiblyStaleNavigationState } from '@react-navigation/core'; +import type { + PossiblyStaleNavigationState, + UnsafeContainerActionEvent, +} from '@react-navigation/core'; import { useReduxDevToolsExtension } from '@react-navigation/devtools'; import { NavigationContainer } from '@react-navigation/native'; import * as SplashScreen from 'expo-splash-screen'; @@ -215,18 +218,21 @@ if (!navContainer) { return undefined; } - return navContainer.addListener('__unsafe_action__', event => { - const { action, noop } = event.data; - const navState = navStateRef.current; - if (noop) { - actionLogger.addOtherAction('navState', action, navState, navState); - return; - } - queuedActionsRef.current.push({ - ...action, - type: `NAV/${action.type}`, - }); - }); + return navContainer.addListener( + '__unsafe_action__', + (event: { +data: UnsafeContainerActionEvent, ... }) => { + const { action, noop } = event.data; + const navState = navStateRef.current; + if (noop) { + actionLogger.addOtherAction('navState', action, navState, navState); + return; + } + queuedActionsRef.current.push({ + ...action, + type: `NAV/${action.type}`, + }); + }, + ); }, [navContainer]); const activeTheme = useSelector(state => state.globalThemeInfo.activeTheme);