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

Overload error when using React 18.2.0 #18

Open
askiefer opened this issue May 10, 2024 · 0 comments
Open

Overload error when using React 18.2.0 #18

askiefer opened this issue May 10, 2024 · 0 comments

Comments

@askiefer
Copy link

When using this library with React 18.2.0 I get this error:

 Overload 1 of 2, '(props: Props | Readonly<Props>): ScreenCapture', gave the following error.
        Type '{ children: ({ onStartCapture }: { onStartCapture: any; }) => Element; onEndCapture: (url: string) => any; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<ScreenCapture> & Readonly<Props>'.
          Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ScreenCapture> & Readonly<Props>'.
      Overload 2 of 2, '(props: Props, context: any): ScreenCapture', gave the following error.
        Type '{ children: ({ onStartCapture }: { onStartCapture: any; }) => Element; onEndCapture: (url: string) => any; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<ScreenCapture> & Readonly<Props>'.
          Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ScreenCapture> & Readonly<Props>'.

    49         <ScreenCapture onEndCapture={onEndCapture}>

Seems like React 18 doesn't have implicit children props anymore.

I have implemented this very similar to the code demonstrated (see below):

 const onEndCapture = (screenCapture: string) => {
        setImagePath(screenCapture);
 }

return (
        <ScreenCapture onEndCapture={onEndCapture}>
        {({ onStartCapture }) => (
            <div>
                ....
            </div>
        )}
        </ScreenCapture>
    );
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

1 participant