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 ...
随机推荐
- idea--IntelliJ IDEA隐藏不想看到的文件或文件夹
打开IntelliJ IDEA,File -> Settings -> Editor -> File Types 在红框部分加上你想过滤的文件或文件夹名
- Eclipse中使用GIT更新项目
GIT更新项目: 右击项目——Team——Pull:
- IOS - PDF合并
#pragma mark - Merge PDF - (void)mergePDF { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSD ...
- Java web课程学习之Request和Response
request和response l HttpServletRequest l 请求转发 l HttpServletResponse l 请求重定向 请求流程 每次请求service(),都会由容 ...
- UVALive-7197 Axles 动态规划 多个背包问题
题目链接:https://cn.vjudge.net/problem/UVALive-7197 题意 需要生产n种(2<=n<=14)零件,每种零件可以用两种材料制作,对这两种材料的消耗相 ...
- CodeForces 362E Petya and Pipes
Petya and Pipes Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on CodeForces. ...
- 一起talk C栗子吧(第一百一十二回:C语言实例--线程同步概述)
各位看官们,大家好.上一回中咱们说的是线程间通信的样例,这一回咱们说的样例是:线程同步.闲话休提,言归正转.让我们一起talk C栗子吧! 看官们,提到同步.我想大家都不陌生,由于我们在前面章回中介绍 ...
- 使用Java语言实现,自己主动生成10个整数(1~100,求出生成数列中的最大值和最小值,不同意使用Arrays类的sort方法
这是考察主要的java基础,没啥难点,直接上代码,近期在准备面试,所以做一些基础的面试题练练手 public class Demo1 { public static void main(String[ ...
- 初识Dubbo 系列之5-Dubbo 成熟度
成熟度 功能成熟度 Feature特征 Maturity成熟度 Strength强度 Problem问题 Advise建议 User用户 并发控制 Tested 并发控制 试用 连接控制 Te ...
- 深搜解Riding the Fences
Riding the Fences Farmer John owns a large number of fences that must be repairedannually. He traver ...