• 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_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 中引入

    最终截图:

  • 相关阅读:
    通过Ajax的方式执行GP服务
    Arcgis for js之GP实现缓冲区计算
    sde用sql实现erase
    OL2中设置鼠标的样式
    OL2中重置地图DIV大小后地图的联动
    OL2中的多地图联动展示
    Codeforces Round #357 (Div. 2) Heap Operations
    POJ-1847 Tram
    【转】一些图论、网络流入门题总结、汇总
    POJ-2398 Toy Storage
  • 原文地址:https://www.cnblogs.com/pxjbk/p/10258906.html
Copyright © 2020-2023  润新知