react-native 编译 undefined is not an object (evaluating '_react2.PropTypes.func')
情况通报:
因为是我的二维码模块报错,提示报错代码如下
重要信息是下面的红色字体部分(Android 模拟器红屏)
undefined is not an object (evaluating '_react2.PropTypes.func')
<unknown>
D:\CDM_POS_APP\pos_shouy\node_modules\react-native-smart-barcode\Barcode.js:38:33
loadModuleImplementation
D:\CDM_POS_APP\pos_shouy\node_modules\metro-bundler\src\Resolver\polyfills\require.js:178:12
guardedLoadModule
D:\CDM_POS_APP\pos_shouy\node_modules\metro-bundler\src\Resolver\polyfills\require.js:130:36
_require
D:\CDM_POS_APP\pos_shouy\node_modules\metro-bundler\src\Resolver\polyfills\require.js:110:20
<unknown>
D:\CDM_POS_APP\pos_shouy\src\QrcodeView.js:17
loadModuleImplementation
D:\CDM_POS_APP\pos_shouy\node_modules\metro-bundler\src\Resolver\polyfills\require.js:178:12
guardedLoadModule
D:\CDM_POS_APP\pos_shouy\node_modules\metro-bundler\src\Resolver\polyfills\require.js:130:36
_require
D:\CDM_POS_APP\pos_shouy\node_modules\metro-bundler\src\Resolver\polyfills\require.js:110:20
<unknown>
D:\CDM_POS_APP\pos_shouy\App.js:31
loadModuleImplementation
D:\CDM_POS_APP\pos_shouy\node_modules\metro-bundler\src\Resolver\polyfills\require.js:178:12
guardedLoadModule
D:\CDM_POS_APP\pos_shouy\node_modules\metro-bundler\src\Resolver\polyfills\require.js:130:36
_require
D:\CDM_POS_APP\pos_shouy\node_modules\metro-bundler\src\Resolver\polyfills\require.js:110:20
<unknown>
D:\CDM_POS_APP\pos_shouy\index.js:2
loadModuleImplementation
D:\CDM_POS_APP\pos_shouy\node_modules\metro-bundler\src\Resolver\polyfills\require.js:178:12
guardedLoadModule
D:\CDM_POS_APP\pos_shouy\node_modules\metro-bundler\src\Resolver\polyfills\require.js:123:45
_require
D:\CDM_POS_APP\pos_shouy\node_modules\metro-bundler\src\Resolver\polyfills\require.js:110:20
global code
解决办法:
找到错误位置的:D:\CDM_POS_APP\pos_shouy\node_modules\react-native-smart-barcode\Barcode.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 中引入
最终截图:

react-native 编译 undefined is not an object (evaluating '_react2.PropTypes.func')的更多相关文章
- react-native 编译报错: undefined is not an object (evaluating '_react2.PropTypes.func')
情况通报: 因为是我的二维码模块报错,提示报错代码如下 重要信息是下面的红色字体部分(Android 模拟器红屏) undefined is not an object (evaluating '_r ...
- undefined is not an object (evaluating '_react2.PropTypes.string')
对所引用的组件原 .import React, {Component,PropTypes} from 'react' 改成:import React, {Component} from 'react' ...
- React-native-camera error with Expo: undefined is not an object (evaluating 'CameraManager.Aspect')
React-native-camera error with Expo: undefined is not an object (evaluating 'CameraManager.Aspect') ...
- 使用react-navigation时报错:undefined is not an object (evaluating rngesturehandlermodule.direction)
问题: 使用react-navigation时报错:undefined is not an object (evaluating rngesturehandlermodule.direction). ...
- react native出现 undefined is not a function_this4.错误函数无法识别
该函数可能里可能有this,的上个函数this要绑定bind(this)
- React Native Expected a component class,got [object Object]解决
报错原因: 组件大小写错误. 解决方式: 修改组件名称即可. 这篇博客介绍了大部分RN的错误原因和解决方法: http://blog.csdn.net/chichengjunma/article/de ...
- undefined is not an object (evaluating 'RNFetchBlob.DocumentDir')
参考https://github.com/wkh237/react-native-fetch-blob/issues/51 自己做了一下总结: 这个报错位置在react-native-fetch-bl ...
- undefined is not an object(evaluating '_react3.default.PropTypes.shape)
手机红屏报这个错时的解决办法: npm uninstall --save react-native-deprecated-custom-components npm install --save ht ...
- React Native随笔——警告处理方法(持续更新)
一.警告propTypes was defined as an instance property on commonTabar. Use a static property to define pr ...
随机推荐
- Pyhton学习——Day61
class Pagination(object): def __init__(self,totalCount,currentPage,perPageItemNum=10,maxPageNum=7): ...
- Pyhton学习——Day25
#面向对象的几个方法#1.静态方法@staticmethod,不能访问类属性,也不能访问实例属性,只是类的工具包#2.类方法:@classmethod,在函数属性前加上类方法,显示为(cls)代表类, ...
- php字符处理
1.strstr 截取某个字符后的字符: echo strstr("123456789","5");//输出:6789
- Laravel 多条件搜索查询
做查询功能时,输入的关键词有的为空,有的有值,如何实现多功能查询呢?这里介绍一种方法.(基于laravel) 原理很简单,第一步:判断接收的值,第二步:写查询语句.具体实现如下: //首先,创建句柄: ...
- MVC设计模式与JavaWEB三层架构
一.MVC设计模式 MVC模式(Model-View-Controller)是软件工程中的一种软件架构模式,把软件系统分为三个基本部分:模型(Model).视图(View)和控制器(Controlle ...
- Ubuntu(Linux Mint):sudo apt-get upgrade升级失败
Ubuntu上进行sudo apt-get upgrade后出现异常,升级失败. 异常信息如下: E: dpkg was interrupted, you must manually run 'dpk ...
- 使用jmap和MAT分析JVM堆内存
http://blog.csdn.net/alli0968/article/details/52460008
- 【中山市选2010】【BZOJ2467】生成树
Description 有一种图形叫做五角形圈.一个五角形圈的中心有1个由n个顶点和n条边组成的圈. 在中心的这个n边圈的每一条边同一时候也是某一个五角形的一条边,一共同拥有n个不同的五角形.这些五角 ...
- magento megatron主题加入中文
magento的megatron默认不支持中文,全部我们须要在它的本地化目录中加入中文的cvs文件,加入方法例如以下: 1.切换至 app ▸ design ▸ frontend ▸ megatron ...
- java解析XML saxReader.read(xml) 错误:org.dom4j.DocumentException: no protocol
java解析XML saxReader.read(xml) 错误:org.dom4j.DocumentException: no protocol 完整错误信息: org.dom4j.Document ...