Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Component cannot be used as a JSX component. Property '$props' is missing in type X but required in type 'ElementClass'

$
0
0

I'm getting this typescript error from basically every component in VSCode, both custom and library components. This is an expo build for react native. This command yields the same results:yarn tsc --project tsconfig.json

here's an example in VSCodeenter image description here

and an example of the full error message:

'KeyboardAvoidingView' cannot be used as a JSX component.  Its instance type 'KeyboardAvoidingView' is not a valid JSX element.    Property '$props' is missing in type 'TimerMixin & KeyboardAvoidingViewComponent' but required in type 'ElementClass'.ts(2786)

This is my .tsconfig:

{"extends": "../../node_modules/expo/tsconfig.base","compilerOptions": {"jsx": "react-native","strict": true  }}

and this is expo's that it extends:

{"$schema": "https://json.schemastore.org/tsconfig","display": "Expo","compilerOptions": {"allowJs": true,"esModuleInterop": true,"jsx": "react-native","lib": ["DOM", "ESNext"],"moduleResolution": "node","noEmit": true,"resolveJsonModule": true,"skipLibCheck": true,"target": "ESNext"  },"exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"]}

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>