I encountered a similar issue, but I was able to resolve it through some trial and error.
https://i.sstatic.net/MhUHb.png
QUICK FIX
To address this issue, make sure that you have both @types/react
and @types/react-native
installed as development dependencies. This step was crucial in my case.
DETAILED SOLUTION
Although I am not certain which specific action fixed the problem, here are all the steps I took:
- I reviewed my eslint configuration settings:
{
"extends": ["react-native-wcandillon", "plugin:prettier/recommended"],
"plugins": ["prettier"],
"rules": {
"max-len": ["error", { "code": 120 }],
"prettier/prettier": [
"warn",
{
"singleQuote": false,
"printWidth": 120
}
]
}
}
- I examined my babel setup
module.exports = {
presets: ["module:metro-react-native-babel-preset"],
plugins: ["react-native-reanimated/plugin"],
};
- I verified my tsconfig configuration:
{
"extends": "eslint-config-react-native-wcandillon/tsconfig.base",
}
- I scrutinized my --dev dependencies and added more (potentially contributing to the solution)
"devDependencies": {
"@babel/core": "^7.21.3",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.21.0",
"@react-native-community/eslint-config": "^3.2.0",
"@tsconfig/react-native": "^2.0.3",
"@types/react": "^18.0.29",
"@types/react-native": "^0.71.5",
"@types/react-test-renderer": "^18.0.0",
"@types/uuid": "^9.0.1",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-react-native-wcandillon": "^3.9.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"jest": "^29.2.1",
"metro-react-native-babel-preset": "0.76.0",
"prettier": "2.8.7",
"react-native-svg-transformer": "^1.0.0",
"react-test-renderer": "18.2.0",
"typescript": "4.8.4"
},