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
Type errors because of types/react~17. #17101
Comments
Hello @j3sch, I'm not able to reproduce the problem using fresh project generated from Can you create the minimal reproduction project and share the code? |
@Simek thank you for your fast response. I have created a new project with the template expo-template-tabs and again got the error in navigation/index.tsx. However, when I opened the project in webstorm, I noticed that these errors were not displayed. I only saw the errors in vscode. And if I update types/react to 18, the errors are gone. But then expo blocks me to start the project. |
It looks like this problem is related to this one, which surfaced in navigation repo a few days ago:
Unfortunately React types cannot be upgraded to EDIT: After a bit more research it looks like the latest release of The problem has also been reported in the DefinitelyTyped repository, so hopefully this will be fixed soon. |
Thanks for looking into this issue and for your help. |
This is hell, but this helped: "resolutions": { "@types/react": "~17.0.21" }, |
Changing to these dependencies worked for me
|
This comment was marked as off-topic.
This comment was marked as off-topic.
For those who don't know (like me before finding out!), add this line on the package.json, on the first level. |
FYI: for whatever reason the |
This is what helped in our project! Remember to do |
i believe this was fixed in a recent @types/react-native release: DefinitelyTyped/DefinitelyTyped#61081 so, i'm closing this. if you find it is not fixed for you please create a new issue with a minimal reproducible example, thanks! |
Summary
I have created a new project with the typescript template, and I get type errors with the react navigation component.
Stack.Navigator' cannot be used as a JSX component.
Because the current version of react navigation requires types/react~18.
Managed or bare workflow? If you have made manual changes inside of the
ios/
orandroid/
directories in your project, the answer is bare!managed
What platform(s) does this occur on?
Android, iOS
Package versions
No response
Environment
System:
OS: macOS 12.3.1
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
Yarn: 1.22.18 - /usr/local/bin/yarn
npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
Watchman: 2022.03.21.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
IDEs:
Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
npmPackages:
expo: ~44.0.0 => 44.0.6
react: 17.0.1 => 17.0.1
react-dom: 17.0.1 => 17.0.1
react-native: 0.64.3 => 0.64.3
react-native-web: 0.17.1 => 0.17.1
npmGlobalPackages:
expo-cli: 5.3.1
Expo Workflow: managed
Reproducible demo
https://github.com/expo/expo/tree/main/templates/expo-template-tabs
Stacktrace (if a crash is involved)
No response
The text was updated successfully, but these errors were encountered: