From dc4ffc0171b4535fe1b6e839b9d54350121bcf55 Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Fri, 14 May 2021 09:43:18 +0200 Subject: [PATCH] fix: fix type error when passing unannotated navigation ref --- example/src/index.tsx | 2 +- packages/core/src/useNavigationContainerRef.tsx | 3 +-- packages/devtools/src/useReduxDevToolsExtension.tsx | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/example/src/index.tsx b/example/src/index.tsx index f049cbfb..0571f0ee 100644 --- a/example/src/index.tsx +++ b/example/src/index.tsx @@ -206,7 +206,7 @@ export default function App() { return () => Dimensions.removeEventListener('change', onDimensionsChange); }, []); - const navigationRef = useNavigationContainerRef(); + const navigationRef = useNavigationContainerRef(); useReduxDevToolsExtension(navigationRef); diff --git a/packages/core/src/useNavigationContainerRef.tsx b/packages/core/src/useNavigationContainerRef.tsx index be50ef8b..b541930f 100644 --- a/packages/core/src/useNavigationContainerRef.tsx +++ b/packages/core/src/useNavigationContainerRef.tsx @@ -1,10 +1,9 @@ import * as React from 'react'; -import type { ParamListBase } from '@react-navigation/routers'; import createNavigationContainerRef from './createNavigationContainerRef'; import type { NavigationContainerRefWithCurrent } from './types'; export default function useNavigationContainerRef< - ParamList extends ParamListBase + ParamList extends {} = ReactNavigation.RootParamList >(): NavigationContainerRefWithCurrent { const navigation = React.useRef | null>( null diff --git a/packages/devtools/src/useReduxDevToolsExtension.tsx b/packages/devtools/src/useReduxDevToolsExtension.tsx index 089781e1..19a2b20f 100644 --- a/packages/devtools/src/useReduxDevToolsExtension.tsx +++ b/packages/devtools/src/useReduxDevToolsExtension.tsx @@ -3,7 +3,6 @@ import type { NavigationContainerRef, NavigationState, NavigationAction, - ParamListBase, } from '@react-navigation/core'; import deepEqual from 'deep-equal'; @@ -23,7 +22,7 @@ type DevToolsExtension = { declare const __REDUX_DEVTOOLS_EXTENSION__: DevToolsExtension | undefined; export default function useReduxDevToolsExtension( - ref: React.RefObject> + ref: React.RefObject> ) { const devToolsRef = React.useRef();