情况通报:
因为是我的二维码模块报错,提示报错代码如下
重要信息是下面的红色字体部分(Android 模拟器红屏)
undefined is not an object (evaluating '_react2.PropTypes.func')
<unknown>
D:CDM_POS_APPpos_shouy
ode_modulesreact-native-smart-barcodeBarcode.js:38:33
loadModuleImplementation
D:CDM_POS_APPpos_shouy
ode_modulesmetro-bundlersrcResolverpolyfills
equire.js:178:12
guardedLoadModule
D:CDM_POS_APPpos_shouy
ode_modulesmetro-bundlersrcResolverpolyfills
equire.js:130:36
_require
D:CDM_POS_APPpos_shouy
ode_modulesmetro-bundlersrcResolverpolyfills
equire.js:110:20
<unknown>
D:CDM_POS_APPpos_shouysrcQrcodeView.js:17
loadModuleImplementation
D:CDM_POS_APPpos_shouy
ode_modulesmetro-bundlersrcResolverpolyfills
equire.js:178:12
guardedLoadModule
D:CDM_POS_APPpos_shouy
ode_modulesmetro-bundlersrcResolverpolyfills
equire.js:130:36
_require
D:CDM_POS_APPpos_shouy
ode_modulesmetro-bundlersrcResolverpolyfills
equire.js:110:20
<unknown>
D:CDM_POS_APPpos_shouyApp.js:31
loadModuleImplementation
D:CDM_POS_APPpos_shouy
ode_modulesmetro-bundlersrcResolverpolyfills
equire.js:178:12
guardedLoadModule
D:CDM_POS_APPpos_shouy
ode_modulesmetro-bundlersrcResolverpolyfills
equire.js:130:36
_require
D:CDM_POS_APPpos_shouy
ode_modulesmetro-bundlersrcResolverpolyfills
equire.js:110:20
<unknown>
D:CDM_POS_APPpos_shouyindex.js:2
loadModuleImplementation
D:CDM_POS_APPpos_shouy
ode_modulesmetro-bundlersrcResolverpolyfills
equire.js:178:12
guardedLoadModule
D:CDM_POS_APPpos_shouy
ode_modulesmetro-bundlersrcResolverpolyfills
equire.js:123:45
_require
D:CDM_POS_APPpos_shouy
ode_modulesmetro-bundlersrcResolverpolyfills
equire.js:110:20
global code
解决办法:
找到错误位置的:D:CDM_POS_APPpos_shouy ode_modules eact-native-smart-barcodeBarcode.js
PropTypes 放在了react 中引入,但是还是出错
Undefined is not an object(evaluating ‘_react2.PropTypes.func’)
正确写法:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
把PropTypes 从prop-types 中引入
最终截图: