Please provide the following:
- SDK Version: 37.0.0 - expo --version shows 3.20.1 - npm --version shows 6.14.2
- Platforms(Android/iOS/web/all): web
Just like this post by @maxit7 at BarCodeScanner.requestPermissionsAsync is not a function, I can’t get past the requestPermissionsAsync() part of my code. I have tried his code sample, and the original sample from the docs: https://docs.expo.io/versions/v37.0.0/sdk/bar-code-scanner/#usage
I have run expo update and npm update.
I get an error:
Unhandled Rejection (TypeError): _ExpoBarCodeScannerModule__WEBPACK_IMPORTED_MODULE_15__.default.requestPermissionsAsync is not a function
requestPermissionsAsync$
C:/Webroot/src/BarCodeScanner.tsx:35
32 | onBarCodeScanned: BarCodeScannedCallback;
33 | }
34 |
> 35 | export class BarCodeScanner extends React.Component<BarCodeScannerProps> {
36 | lastEvents: { [key: string]: any } = {};
37 | lastEventsTimes: { [key: string]: any } = {};
38 |
View compiled
▶ 10 stack frames were collapsed.
Function.requestPermissionsAsync
C:/Webroot/src/BarCodeScanner.tsx:35
32 | onBarCodeScanned: BarCodeScannedCallback;
33 | }
34 |
> 35 | export class BarCodeScanner extends React.Component<BarCodeScannerProps> {
36 | lastEvents: { [key: string]: any } = {};
37 | lastEventsTimes: { [key: string]: any } = {};
38 |
View compiled
_callee$
C:/Webroot/freightapp-native/App.js:10
7 | const [scanned, setScanned] = useState(false);
8 |
9 | useEffect(() => {
> 10 | (async () => {
| ^ 11 | const { status } = await BarCodeScanner.requestPermissionsAsync();
12 | setHasPermission(status === 'granted');
13 | })();
View compiled
▶ 10 stack frames were collapsed.
_callee
C:/Webroot/freightapp-native/App.js:10
7 | const [scanned, setScanned] = useState(false);
8 |
9 | useEffect(() => {
> 10 | (async () => {
| ^ 11 | const { status } = await BarCodeScanner.requestPermissionsAsync();
12 | setHasPermission(status === 'granted');
13 | })();
View compiled
(anonymous function)
C:/Webroot/freightapp-native/App.js:10
7 | const [scanned, setScanned] = useState(false);
8 |
9 | useEffect(() => {
> 10 | (async () => {
| ^ 11 | const { status } = await BarCodeScanner.requestPermissionsAsync();
12 | setHasPermission(status === 'granted');
13 | })();