Hello everyone I am getting this error in my RN project :"'View' cannot be used as a JSX component.Its instance type 'View' is not a valid JSX element"This was a project that I cloned I didn't created it. All the React Native elements are outputting the same error, It's not just View. I tried everything but couldn't come up with a solution.
Here is my package.json
{"name": "retail-mobile","version": "2.154.0","private": true,"resolutions": {"@types/react": "17.0.2","@types/react-dom": "17.0.2" },"scripts": {"android": "react-native run-android","ios": "react-native run-ios --simulator=\"iPhone 11 (15.5)\"","start": "react-native start -- --reset-cache > /dev/null","version:major": "npm version major -no-git-tag-version","version:minor": "npm version minor -no-git-tag-version","version:patch": "npm version patch -no-git-tag-version","codepush": " yarn push:staging && yarn push:production","push:staging": "yarn version:patch && npx json -I -f app.json -e \"this.enrollVersion='Staging'\" && yarn push:staging:ios && yarn push:staging:android ","push:production": "yarn version:minor && npx json -I -f app.json -e \"this.enrollVersion='Production'\" && yarn push:ios && yarn push:android ","push:ios": "appcenter codepush release-react -a maple-tech/retail-mobile -d Production --mandatory -t '5.6.0'","push:android": "appcenter codepush release-react -a maple-tech/retail-mobile-1 -d Production --mandatory -t '2.4.0'","push:staging:ios": "appcenter codepush release-react -a maple-tech/retail-mobile -d Staging --mandatory -t '5.0.1'","push:staging:android": "yarn version:patch && npx json -I -f app.json -e \"this.enrollVersion='Staging'\" && appcenter codepush release-react -a maple-tech/retail-mobile-1 -d Staging --mandatory -t '2.0.2'","push:android-alpha": "yarn version:patch && npx json -I -f app.json -e \"this.enrollVersion='Staging'\" && yarn push:staging:android","test": "jest","lint": "eslint . --ext .js,.jsx,.ts,.tsx","auto:push": "git add . ; git commit -m 'Auto Commit'; git push -u ","npm-pod-install": "yarn && npx pod-install","clear-npm-pod-cache": "rm -rf ios/Podfile.lock && rm -rf package-lock.json && npx pod-install","clear-cache": "bash ./resetXcode.sh && watchman watch-del-all && rm -rf $TMPDIR/react-* && npm cache verify && rm -rf node_modules/ && npm run clear-npm-pod-cache && rm -rf ios/build/ ","build:android-debug": "detox build -c android.emu.debug","build:android-release": "detox build -c android.emu.release","build:ios-debug": "detox build -c ios.sim.debug","build:ios-release": "detox build -c ios.sim.release","test:android-debug": "detox test -c android.emu.debug -l verbose","test:android-release": "detox test -c android.emu.release -l verbose","test:ios-debug": "detox test -c ios.sim.debug -l verbose","test:ios-release": "detox test -c ios.sim.release -l verbose","test:ios-none": "detox test -c ios.none -l verbose","detox-server": "detox run-server" },"jest": {"preset": "react-native","moduleFileExtensions": ["ts","tsx","js","jsx","json","node" ] },"dependencies": {"@archireport/react-native-svg-draw": "^1.0.2","@dudigital/react-native-zoomable-view": "^1.1.3","@emotion/native": "^11.0.0","@emotion/react": "^11.9.0","@gorhom/bottom-sheet": "^4.3.1","@motify/interactions": "^0.17.1","@native-html/table-plugin": "^5.3.1","@react-native-async-storage/async-storage": "^1.17.5","@react-native-community/geolocation": "^2.1.0","@react-native-community/hooks": "^2.8.1","@react-native-community/masked-view": "^0.1.11","@react-native-community/netinfo": "^7.1.12","@react-native-community/push-notification-ios": "^1.10.1","@react-native-firebase/analytics": "^14.11.0","@react-native-firebase/app": "^14.11.0","@react-native-firebase/crashlytics": "^14.11.0","@react-native-firebase/firestore": "^14.11.0","@react-native-firebase/in-app-messaging": "^14.11.0","@react-native-firebase/messaging": "^14.11.0","@react-native-firebase/perf": "^14.11.0","@react-navigation/bottom-tabs": "^6.3.1","@react-navigation/core": "^6.2.1","@react-navigation/drawer": "^6.4.1","@react-navigation/native": "^6.0.10","@react-navigation/stack": "^6.2.1","@terrylinla/react-native-sketch-canvas": "^0.8.0","axios": "^0.24.0","buffer": "^6.0.3","color": "3.2.1","dayjs": "^1.11.2","exceljs": "^4.3.0","formik": "^2.2.9","hi-base32": "^0.5.1","i18next": "^21.8.5","i18next-http-backend": "^1.4.1","intl-pluralrules": "^1.3.1","lodash": "^4.17.21","lottie-ios": "3.2.3","lottie-react-native": "^5.1.3","moti": "^0.18.0","react": "^17.0.2","react-i18next": "^11.16.7","react-native": "^0.67.3","react-native-action-sheet": "^2.2.0","react-native-calendars": "^1.1284.0","react-native-camera": "^4.2.1","react-native-code-push": "^7.0.4","react-native-config": "^1.4.5","react-native-device-info": "^8.7.1","react-native-document-picker": "^8.1.0","react-native-emoji-selector": "^0.2.0","react-native-fast-image": "^8.5.11","react-native-file-viewer": "^2.1.5","react-native-flipper": "^0.146.1","react-native-fs": "^2.20.0","react-native-gesture-handler": "^1.10.3","react-native-html-to-pdf": "^0.12.0","react-native-image-crop-picker": "^0.37.3","react-native-image-resizer": "^1.4.5","react-native-image-zoom-viewer": "^3.0.1","react-native-iphone-x-helper": "^1.3.1","react-native-keyboard-aware-scroll-view": "^0.9.5","react-native-lightbox": "^0.8.1","react-native-linear-gradient": "^2.5.6","react-native-localize": "^2.2.1","react-native-maps": "0.31.1","react-native-modal": "^13.0.1","react-native-pager-view": "^5.4.24","react-native-paper": "^4.12.1","react-native-push-notification": "^8.1.1","react-native-ratings": "^8.1.0","react-native-reanimated": "^2.8.0","react-native-render-html": "^6.3.4","react-native-safe-area-context": "^4.2.5","react-native-screens": "^3.13.1","react-native-share": "^7.4.1","react-native-signature-canvas": "^4.3.0","react-native-snackbar": "^2.4.0","react-native-snap-carousel": "^3.9.1","react-native-svg": "^12.3.0","react-native-tab-view": "^2.6.1","react-native-table-component": "^1.2.2","react-native-url-polyfill": "^1.3.0","react-native-vector-icons": "^9.1.0","react-native-video": "^5.2.0","react-native-view-shot": "^3.3.0","react-native-webview": "^11.21.0","react-query": "^3.39.1","react-redux": "^7.2.8","redux": "^4.2.0","redux-logger": "^3.0.6","redux-persist": "^6.0.0","redux-saga": "^1.1.3","rn-placeholder": "^3.0.3","url-parse": "^1.5.10","victory-native": "^36.4.1","xlsx": "^0.18.5","yup": "^0.32.11","zustand": "4.0.0-rc.1" },"devDependencies": {"@babel/core": "^7.18.2","@babel/preset-typescript": "^7.17.12","@babel/runtime": "^7.18.3","@types/color": "^3.0.3","@types/jest": "^27.5.1","@types/lodash": "^4.14.182","@types/react": "^18.0.9","@types/react-native": "^0.67.7","@types/react-native-calendars": "^1.1264.3","@types/react-native-html-to-pdf": "^0.8.1","@types/react-native-push-notification": "^8.1.0","@types/react-native-snap-carousel": "^3.8.5","@types/react-native-svg-charts": "^5.0.12","@types/react-native-table-component": "^1.2.4","@types/react-native-vector-icons": "^6.4.10","@types/react-native-video": "^5.0.13","@types/react-redux": "^7.1.24","@types/react-test-renderer": "^18.0.0","@types/redux": "^3.6.0","@types/redux-logger": "^3.0.9","@types/redux-saga": "^0.10.5","@types/xlsx": "^0.0.36","@types/yup": "^0.29.14","@typescript-eslint/eslint-plugin": "^5.26.0","@typescript-eslint/parser": "^5.26.0","babel-jest": "^28.1.0","babel-plugin-module-resolver": "^4.1.0","babel-plugin-transform-remove-console": "^6.9.4","detox": "^19.7.0","eslint": "^8.16.0","eslint-plugin-react-hooks": "^4.5.0","eslint-plugin-react-native": "^4.0.0","fs-extra": "^10.1.0","jest": "^28.1.0","jest-circus": "^28.1.0","jetifier": "^2.0.0","json": "^11.0.0","metro-react-native-babel-preset": "^0.70.2","patch-package": "^6.4.7","postinstall-postinstall": "^2.1.0","prettier": "^2.6.2","react-devtools": "^4.24.6","react-native-clean-project": "^4.0.1","react-native-flipper-zustand": "^1.0.2","react-native-svg-transformer": "^1.0.0","react-test-renderer": "17.0.2","redux-devtools": "^3.7.0","redux-flipper": "^2.0.1","rn-async-storage-flipper": "^0.0.10","sanitize-filename": "^1.6.3","ts-jest": "^28.0.3","ts-node": "^10.8.0","typescript": "^4.7.2" }}
I added
"resolutions": {"@types/react": "17.0.2","@types/react-dom": "17.0.2" },
but it didn't work.