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

Typescript issue #2922

Closed
juliusspencer opened this issue Mar 6, 2018 · 4 comments
Closed

Typescript issue #2922

juliusspencer opened this issue Mar 6, 2018 · 4 comments

Comments

@juliusspencer
Copy link

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.27
  • react-native v0.53.3

Expected behaviour

When using typescript I expect there to be no error when I don't supply a component using a drawer.

Actual behaviour

I get the following error using Typescript with the following Scene JSX:

<Scene
	key="drawer"
	drawer={true}
	contentComponent={NavDrawer}
	hideNavBar={true}
	drawerIcon={this.navDrawerImage()}
>

src/App.tsx(103,10): error TS2322: Type '{ key: "drawer"; drawer: true; contentComponent: ComponentClass<Pick<Props & Actions, never>> & {...' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<SceneProps & TabsProps & TabSceneProps &...'.
Type '{ key: "drawer"; drawer: true; contentComponent: ComponentClass<Pick<Props & Actions, never>> & {...' is not assignable to type 'Readonly<SceneProps & TabsProps & TabSceneProps & DrawerProps & ModalProps>'.
Property 'component' is missing in type '{ key: "drawer"; drawer: true; contentComponent: ComponentClass<Pick<Props & Actions, never>> & {...'.

Steps to reproduce

For non-obvious bugs, please fork this component, modify Example project to reproduce your issue and include link here.

  1. Use the JSX above with a NavDrawer Component.
  2. Use tsc to transpile
  3. View the output log

Fix

I think this could be fixed by changing:

component: React.ComponentType<any>

to

component?: React.ComponentType<any>
@thomashagstrom
Copy link

Dito. Very annoying

@windwang
Copy link

windwang commented Apr 2, 2018

+1

1 similar comment
@JosePBrotons
Copy link

+1

@aksonov
Copy link
Owner

aksonov commented Aug 8, 2018

Should be fixed now

@aksonov aksonov closed this as completed Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants