Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing result of createStackNavigator into createAppContainer causes type error #7032

Closed
chrispaynter opened this issue Jan 2, 2020 · 0 comments

Comments

@chrispaynter
Copy link

I've just upgraded to version 2.0.1. I'm using Typescript.

Before the upgrade the following code worked with no typing issues.

const ModalWrappedNavigator = createStackNavigator(
  {
    Main: TabNavigator
  },
  {
    mode: 'modal',
    headerMode: 'none',
    initialRouteName: 'Main',
  },
);

...

export const AppContainer = createAppContainer(ModalWrappedNavigator);

I'm now getting a type error from the parameter ModalWrappedNavigator being passed into createAppContainer from react-navigation (version 4.0.10, was not upgraded).

Argument of type 'ComponentType<{}>' is not assignable to parameter of type 'NavigationNavigator<unknown, unknown>'.
  Type 'ComponentClass<{}, any>' is not assignable to type 'NavigationNavigator<unknown, unknown>'.
    Type 'ComponentClass<{}, any>' is not assignable to type 'ComponentClass<NavigationNavigatorProps<unknown, {}, unknown>, any> & { router: NavigationRouter<unknown, {}>; navigationOptions?: unknown; }'.
      Property 'router' is missing in type 'ComponentClass<{}, any>' but required in type '{ router: NavigationRouter<unknown, {}>; navigationOptions?: unknown; }'.ts(2345)

image

Application runs fine at run time FYI.

@satya164 satya164 transferred this issue from react-navigation/stack Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants