I am using react native and trying to use the
react-native-qrcode-scanner
(I also npm installed: react-native-camera and react-native-permissions)
The command I did to install all of the above packages is: npm install module@latest --save
package to read QR codes but when I try to run my code this error pops up :
ERROR in ./node_modules/react-native-camera/src/RNCamera.js:9:24
Module not found: Can't resolve 'react-native-web/dist/exports/PermissionsAndroid'
7 | NativeModules,
8 | ViewPropTypes,
> 9 | requireNativeComponent,
| ^
10 | View,
11 | ActivityIndicator,
12 | Text,
ERROR in ./node_modules/react-native-qrcode-scanner/index.js:4:35
Module not found: Can't resolve 'react-native-web/dist/exports/PermissionsAndroid'
2 |
3 | import React, { Component } from 'react';
> 4 | import PropTypes from 'prop-types';
| ^
5 |
6 | import {
7 | StyleSheet,
web compiled with 2 errors and 3 warnings
(I didn't include the warnings because I don't think they are needed to solve the problems if you do need them tell me I will update this)
So my code was pulled from a random link on Google I don't really remember which but here is the code
import QRCodeScanner from 'react-native-qrcode-scanner';
const MyQRCodeScanner = () => {
const onSuccess = (e) => {
console.log(e.data);
// e.data contains the QR code data
};
return (
<QRCodeScanner onRead={onSuccess} />
);
};