undefined is not an object(evaluating '_react2.PropTypes.oneOfType')

problem:

When using the two-dimensional code scanning ac-qrcode packet error "undefined is not an object (evaluating '_react2.PropTypes.oneOfType')"

Version information package is as follows:

"react": "16.3.1",
"ac-qrcode": "^1.0.1",

solution

The reason: ac-qrcode dependent on "react-native-camera": "^ 0.7.0", this version comes with PropTypes is a reference to react, but react starting from version 16, has

PropTypes shift out function, it can be referenced from a third party package 'prop-types' of. Look at me react with version 16.3.1 version, so I do not support PropTypes.

react-native-camera after version 0.10.0 has been changed from the reference 'prop-types' in

Solution:

1, see the latest version of the ac-qrcode see if there will be dependencies react-native-camera upgrade to version 0.10.0 or later, you can update

      This step does not go through, to stop the project of maintenance of the project

2, modify the source code in the existing release

1), the react-native-camera project index.js RropTypes referenced from the package prop-types

2), QRScanner.js in ac-qrcode project above, add

import PropTypes from 'prop-types';

3), QRScanner.js in ac-qrcode project in all React.PropTypes into PropTypes

4), the installation package prop-types

npm install --save prop-types

So far, the problem has been solved!

Github attach the issues discussed: https://github.com/MarnoDev/AC-QRCode-RN/issues/24

Guess you like

Origin blog.csdn.net/taoerchun/article/details/90380574