diff --git a/src/index.tsx b/src/index.tsx index dabff85..5c2d2e7 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -29,13 +29,13 @@ const DEFAULT_TRANSITION = ( interface Props { navigation: NavigationProp & { - navigationConfig: { transition?: React.ElementType }; + navigationConfig: { transition?: React.ReactNode }; }; descriptors: { [key: string]: NavigationDescriptor }; screenProps?: ScreenProps; } -class AnimatedSwitchView extends React.Component { +class AnimatedSwitchView extends React.Component { containerRef = React.createRef(); componentDidUpdate(prevProps: Props) { @@ -75,13 +75,13 @@ class AnimatedSwitchView extends React.Component { } export interface AnimatedSwitchNavigatorConfig extends SwitchNavigatorConfig { - transition?: React.ElementType; + transition?: React.ReactNode; } export default function createAnimatedSwitchNavigator( routeConfigMap: NavigationRouteConfigMap, switchConfig: SwitchNavigatorConfig & { - transition?: React.ElementType; + transition?: React.ReactNode; } ): NavigationContainer { const router = SwitchRouter(routeConfigMap, switchConfig); diff --git a/types/@react-navigation/core.d.ts b/types/@react-navigation/core.d.ts index 9ea4181..244b052 100644 --- a/types/@react-navigation/core.d.ts +++ b/types/@react-navigation/core.d.ts @@ -5,6 +5,7 @@ declare module '@react-navigation/core' { NavigationRouteConfigMap, NavigationContainer, SwitchNavigatorConfig, + NavigationRouter, } from 'react-navigation'; export const SceneView: React.ComponentType<{ @@ -15,14 +16,14 @@ declare module '@react-navigation/core' { export function createNavigator( StackView: React.ComponentType, - router: any, - stackConfig: object + router: NavigationRouter, + navigatorConfig?: {} | null ): NavigationContainer; export function SwitchRouter( routeConfigMap: NavigationRouteConfigMap, switchConfig: SwitchNavigatorConfig & { - transition?: React.ElementType; + transition?: React.ReactNode; } ); }