admin 管理员组文章数量: 1086019
Pls anyone help me how to fix this error "ERROR Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'." i have tried many things like deleting node modules npm install deprecated-react-native-prop-types but nothing works for me how can i fix now
package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@react-native-munity/masked-view": "0.1.10",
"@react-navigation/bottom-tabs": "^5.11.10",
"@react-navigation/pat": "^5.3.20",
"@react-navigation/native": "^5.9.4",
"@react-navigation/stack": "^5.14.4",
"deprecated-react-native-prop-types": "^2.3.0",
"expo": "^46.0.0",
"expo-av": "~12.0.4",
"expo-linear-gradient": "~11.4.0",
"expo-status-bar": "~1.4.0",
"haversine": "^1.1.1",
"invariant": "^2.2.4",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.5",
"react-native-animatable": "^1.3.3",
"react-native-flexi-radio-button": "^0.2.2",
"react-native-fontawesome": "^7.0.0",
"react-native-gesture-handler": "~2.5.0",
"react-native-modal": "^13.0.0",
"react-native-modalize": "^2.0.8",
"react-native-progress-circle": "^2.1.0",
"react-native-reanimated": "~2.9.1",
"react-native-safe-area-context": "4.3.1",
"react-native-screens": "~3.15.0",
"react-native-snap-carousel": "^3.9.1",
"react-native-swiper": "^1.6.0",
"react-native-web": "~0.18.7",
"react-navigation": "^4.4.4",
"rn-sliding-up-panel": "^2.4.5"
},
"devDependencies": {
"@babel/core": "^7.18.6"
},
"private": true
}
babel.config.js
module.exports = { presets: ['module:metro-react-native-babel-preset'], plugins: ['react-native-reanimated/plugin'], };
Pls anyone help me how to fix this error "ERROR Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'." i have tried many things like deleting node modules npm install deprecated-react-native-prop-types but nothing works for me how can i fix now
package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@react-native-munity/masked-view": "0.1.10",
"@react-navigation/bottom-tabs": "^5.11.10",
"@react-navigation/pat": "^5.3.20",
"@react-navigation/native": "^5.9.4",
"@react-navigation/stack": "^5.14.4",
"deprecated-react-native-prop-types": "^2.3.0",
"expo": "^46.0.0",
"expo-av": "~12.0.4",
"expo-linear-gradient": "~11.4.0",
"expo-status-bar": "~1.4.0",
"haversine": "^1.1.1",
"invariant": "^2.2.4",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.5",
"react-native-animatable": "^1.3.3",
"react-native-flexi-radio-button": "^0.2.2",
"react-native-fontawesome": "^7.0.0",
"react-native-gesture-handler": "~2.5.0",
"react-native-modal": "^13.0.0",
"react-native-modalize": "^2.0.8",
"react-native-progress-circle": "^2.1.0",
"react-native-reanimated": "~2.9.1",
"react-native-safe-area-context": "4.3.1",
"react-native-screens": "~3.15.0",
"react-native-snap-carousel": "^3.9.1",
"react-native-swiper": "^1.6.0",
"react-native-web": "~0.18.7",
"react-navigation": "^4.4.4",
"rn-sliding-up-panel": "^2.4.5"
},
"devDependencies": {
"@babel/core": "^7.18.6"
},
"private": true
}
babel.config.js
module.exports = { presets: ['module:metro-react-native-babel-preset'], plugins: ['react-native-reanimated/plugin'], };
Share
Improve this question
asked Sep 22, 2022 at 7:11
user20659824user20659824
8
- this is due to unupdated libraries, you need to remove them or update them yourself... Btw this is an error only on react-native 0.69 and above so you can also downgrade your project react-native version. – lmasneri Commented Sep 22, 2022 at 9:36
- @lmasneri what will the solution of it pls tell solution step wise – user20659824 Commented Sep 22, 2022 at 16:03
- The solution would be to find the deprecated library, in the error it is mentioned where the error is. And the other solution is to downgrade to react-native 0.68.3 using the react-native upgrade helper (react-native-munity.github.io/upgrade-helper) – lmasneri Commented Sep 23, 2022 at 14:00
- @lmasneri not working i have tried – user20659824 Commented Sep 23, 2022 at 14:07
- it still does not work without any 3rd party library ? – lmasneri Commented Sep 27, 2022 at 14:51
3 Answers
Reset to default 4You will need to check all of the downloaded dependencies in the node_modules folder which contains the following import statement.
import { ViewPropTypes } from 'react-native';
Change it imports from deprecated-react-native-prop-types
manually.
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
In addition to kiuQ's answer, react-native-progress-circle
is most likely the problem here. It has been deprecated, and the ViewPropTypes is a known issue in that package.
Remove it from your project, or simply replace it with https://www.npmjs./package/progress-circle-react-native
Just like @kiuQ said above, you need to first install deprecated-react-native-prop-types:
npm i deprecated-react-native-prop-types
.
Then after that, find where the error is on the terminal click its link to find where the ViewPropTypes
was imported. Remove it and import it on its own like this:
import {ViewPropTypes} from "deprecated-react-native-prop-types"
本文标签: javascriptInvariant Violation ViewPropTypes has been removed from React NativeStack Overflow
版权声明:本文标题:javascript - Invariant Violation: ViewPropTypes has been removed from React Native - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744090749a2531987.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论