简体   繁体   English

我该如何解决这个错误 Invariant Violation: ViewPropTypes has been removed from React Native

[英]How can i fix this error Invariant Violation: ViewPropTypes has been removed from React Native

How to fix this error i am using expo react native ERROR Invariant Violation: ViewPropTypes has been removed from React Native.如何解决这个错误我正在使用 expo react native ERROR Invariant Violation: ViewPropTypes has been removed from React Native。 Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.迁移到从 'deprecated-react-native-prop-types' 导出的 ViewPropTypes。 this is the errors pls also check my code i have provided这是错误请检查我提供的代码在此处输入图像描述

My package.json我的 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-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",
    "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",
    "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
}

my app.json我的应用程序.json

{
  "expo": {
    "name": "amdy-edu",
    "slug": "amdy-edu",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      }
    },
    "web": {
      "favicon": "./assets/favicon.png"
    }
  }
}

my babel.config.js我的 babel.config.js

module.exports = function(api) {
  api.cache(true);
  return {
    presets: ['module:metro-react-native-babel-preset'],
    plugins: ['react-native-reanimated/plugin'],
  };
};

The correct fix here is to switch to deprecated-react-native-prop-types or a type system like Typescript.正确的解决方法是切换到deprecated-react-native-prop-types或像 Typescript 这样的类型系统。

The problem lies in react-native-snap-carousel.问题在于 react-native-snap-carousel。 You have 2 choices.你有2个选择。 You either find an alternative or you navigate to node_modules/react-native-snap-carousel and change all imports to deprecated types.您要么找到替代方案,要么导航到 node_modules/react-native-snap-carousel 并将所有导入更改为不推荐使用的类型。

This helped me solve the same issue, Use this instead.这帮助我解决了同样的问题,改用这个。

npm i git+https://github.com/LarvenLLC/react-native-snap-carousel.git

Reference: https://github.com/meliorence/react-native-snap-carousel/pull/929#issuecomment-1221294797参考: https://github.com/meliorence/react-native-snap-carousel/pull/929#issuecomment-1221294797

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 不变违规:ViewPropTypes 已从 React Native 中移除 - Invariant Violation: ViewPropTypes has been removed from React Native 如何在React中修复“不变违规”错误 - How to fix “Invariant violation” error in React 反应本机不变违反错误 - React native invariant violation error WARN ViewPropTypes 将从 React Native 中移除。 迁移到从 'deprecated-react-native-prop-types' 导出的 ViewPropTypes - WARN ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types' React-Native Expo 应用程序突然无法运行,因为 Invariant Violation: 'main' has not been registered - React-Native Expo app suddenly will not run because of Invariant Violation: 'main' has not been registered 在 React Native 中使用 react-navigation v6 的 Auth Flow 出现问题。 错误:无效的挂钩调用。 不变违规:“main”尚未注册 - Issue with Auth Flow using react-navigation v6 in React Native. Error: Invalid hook call. Invariant Violation: "main" has not been registered React-Native - 错误:`StackViewTransitionConfigs` 已被删除 - React-Native - Error: `StackViewTransitionConfigs` has been removed Picker 已从 React Native 中移除。 现在可以从“@react-native-picker/picker”安装和导入它 - Picker has been removed from React Native. It can now be installed and imported from '@react-native-picker/picker' React Native - 不变违规“RNDateTimePicker” - React Native - Invariant Violation "RNDateTimePicker" 简单 React Native 应用程序的不变违规和渲染错误 - Invariant Violation & Render Error on Simple React Native App
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM