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 ...
随机推荐
- LeetCode Golang 5. 最长回文子串
5. 最长回文子串 给定一个字符串 s,找到 s 中最长的回文子串.你可以假设 s 的最大长度为 1000. 示例 1: 输入: "babad" 输出: "bab&quo ...
- IOS - autoresizingMask
提醒:当frame设定死,慎用autoresizingMask:否则该frame变形的难以想象.
- c++里面的单冒号和双冒号
c++ 中的单冒号与双冒号 1.冒号(:)用法 (1)表示机构内位域的定义(即该变量占几个bit空间) typedef struct _XXX{ unsigned char a:4; unsigned ...
- uboot的readme导读
UBOOT的移植其实并没有想象中的难,这主要归功于众多的工程师已经将常见的平台代码写入了UBOOT,我们所要做的就是一点小小的更改,在网上看了很多相关的移植,也听到有人说其实看了UBOOT的readm ...
- Django -聚合分组,FQ操作, cookie, session
一. 聚合查询和分组 1. 聚合 aggregate(*args, **kwargs) 对一组数据进行统计分析, 通过对QuerySet进行计算, 返回一个聚合值得字典. arrgregate()中每 ...
- AJAX 创建对象 请求 响应 readyState
AJAX 创建对象 请求 响应 readyState AjAX = Asynchronous JavaScript and XML (异步的JavaScrip和 XML). 不是新的编程语言, 而是一 ...
- JavaScript实现html页面转换成图片格式
本文提供三个JavaScript插件,并提供对应GitHub地址,自行查看使用方法: 1)dom-to-image:dom-to-image 2)html2canvas:html2canvas 3)r ...
- js本地对象——Date()
Date()是JavaScript的本地对象,用于获取当前的时间,包括年.月.日.时.分.秒,可以精确到毫秒级:该对象返回的是UTC 协调世界时(Coordinated Universal Time) ...
- nginx虚拟主机的配置不生效
这个坑找了好久,今天终于找到了问题所在. 一般虚拟主机配置文件是vhost里面单独写一个网站名.conf,然后在nginx最后include vhosts/*.conf 引用. 但是我这里的vhost ...
- c/c++常见试题