不变违背:ViewPropTypes已从React本机中删除

vs3odd8k  于 2023-01-27  发布在  React
关注(0)|答案(2)|浏览(184)

请任何人帮助我如何修复此错误“ERROR Invariant Violation:ViewPropTypes已从React Native中删除。迁移到从“deprecated-react-native-prop-types”导出的ViewPropTypes。”我尝试了许多操作,如删除节点模块npm安装deprecated-react-native-prop-types,但没有任何效果,我现在如何修复x1c 0d1x

软件包. 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-community/masked-view": "0.1.10",
    "@react-navigation/bottom-tabs": "^5.11.10",
    "@react-navigation/compat": "^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
}

数据库配置

module.exports = { presets: ['module:metro-react-native-babel-preset'], plugins: ['react-native-reanimated/plugin'], };
2vuwiymt

2vuwiymt1#

您需要检查node_modules文件夹中所有下载的依赖项,该文件夹包含以下import语句。

import { ViewPropTypes } from 'react-native';

手动将其更改为从deprecated-react-native-prop-types导入。

import { ViewPropTypes } from 'deprecated-react-native-prop-types';
xpszyzbs

xpszyzbs2#

除了kiuQ的答案,react-native-progress-circle很可能是这里的问题,它已经被弃用,ViewPropTypes是该包中的一个已知问题。
将其从项目中移除,或直接替换为https://www.npmjs.com/package/progress-circle-react-native

相关问题