误差
deprecated-react-native-prop-types
“react原生”:"0.69.1",
I am facing this issues when I installed any of this library
-react-native-snap-carousel
-react-native-fast-image需要模块"node_modules/react-native-snap-carousel/src/index.js",,该模块抛出异常:不变冲突: ViewPropTypes已从React中删除。迁移到从“反推荐-反应-本机-支柱-类型”导出的ViewPropTypes。
发布于 2022-09-24 19:24:20
打开文件
./node_modules/react-native-snap-carousel/src/carousel/Carousel.js
./node_modules/react-native-snap-carousel/src/Pagination/Pagination.js
./node_modules/react-native-snap-carousel/src/Pagination/PaginationDot.js
./node_modules/react-native-snap-carousel/src/ParallaxImage/ParallaxImage.js编辑
import { ... ,ViewPropTypes } from 'react-native';至
import { ... } from 'react-native';
import {ViewPropTypes} from 'deprecated-react-native-prop-types';会管用的..。
发布于 2022-08-03 08:35:54
--这是旧npm包的错误,如果项目还在运行,那么开发人员就会在新版本中修复它。当您将包更新为新的包时,这个错误可能会消失。。
我发现此错误安装类型记录包的解决方案还应该安装类型定义,以解决对snap库的错误“反推荐-反应-本机-支持类型”。
$ npm install --save @types/react-native-snap-carousel
**THIS IS WORKING PERFECT FOR ME**我更喜欢遵循第一种方法
或您可以采用不同的方法
在出现错误的节点模块中查找ViewPropTypes导入,删除该文件,从“react-本机”导入该文件,并创建新的导入
import {ViewPropTypes} from 'react-native';
import {ViewPropTypes} from 'deprecated-react-native-prop-types';而且它也很好用,但是当您再次安装新包或npm安装时,您必须再次对库执行此步骤,这会导致相同的错误。
发布于 2022-08-24 09:47:07
下面是答案,安装这个包反对-反应-本机-支柱-类型,如果你安装了一个新的软件包,搜索这个包,替换下面的模块。以下是对node_modules/react-native/index.js的更改
diff --git a/node_modules/react-native/index.js b/node_modules/react-native/index.js
index d59ba34..1bc8c9d 100644
--- a/node_modules/react-native/index.js
+++ b/node_modules/react-native/index.js
@@ -435,32 +435,16 @@ module.exports = {
},
// Deprecated Prop Types
get ColorPropType(): $FlowFixMe {
- invariant(
- false,
- 'ColorPropType has been removed from React Native. Migrate to ' +
- "ColorPropType exported from 'deprecated-react-native-prop-types'.",
- );
+ return require('deprecated-react-native-prop-types').ColorPropType;
},
get EdgeInsetsPropType(): $FlowFixMe {
- invariant(
- false,
- 'EdgeInsetsPropType has been removed from React Native. Migrate to ' +
- "EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.",
- );
+ return require('deprecated-react-native-prop-types').EdgeInsetsPropType;
},
get PointPropType(): $FlowFixMe {
- invariant(
- false,
- 'PointPropType has been removed from React Native. Migrate to ' +
- "PointPropType exported from 'deprecated-react-native-prop-types'.",
- );
+ return require('deprecated-react-native-prop-types').PointPropType;
},
get ViewPropTypes(): $FlowFixMe {
- invariant(
- false,
- 'ViewPropTypes has been removed from React Native. Migrate to ' +
- "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",
- );
+ return require('deprecated-react-native-prop-types').ViewPropTypes;
},
};https://stackoverflow.com/questions/73149910
复制相似问题