Skip to content

'Onboarding' cannot be used as a JSX component #159

@juanmigdr

Description

@juanmigdr

Hello,

Thank you so much for this amazing library!

After updating to the latest Expo version, I am encountering the following error:

screens/OnboardingScreen.tsx:34:8 - error TS2786: 'Onboarding' cannot be used as a JSX component.
  Its type 'typeof Onboarding' is not a valid JSX element type.
    Types of construct signatures are incompatible.
      Type 'new (props: Props) => Onboarding' is not assignable to type 'new (props: any, deprecatedLegacyContext?: any) => Component<any, any, any>'.
        Property 'refs' is missing in type 'Onboarding' but required in type 'Component<any, any, any>'.

34       <Onboarding
          ~~~~~~~~~~

  node_modules/@types/react/index.d.ts:1040:9
    1040         refs: {
                 ~~~~
    'refs' is declared here.


Found 1 error in screens/OnboardingScreen.tsx:34

I’ve investigated and found that if I update @types/react to the latest version, the error seems to go away. However, the problem is that the latest supported version of @types/react for Expo is 18.3.12, and when running it, expo-doctor fails when using the latest version of React types.

I’m hoping for a solution that resolves this issue without having to upgrade @types/react cause it would mean expo-doctor will fail on my project. Any help would be greatly appreciated!

Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions