diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-10-17 20:07:18 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-10-17 20:07:18 +0530 |
commit | 3b6a18902ee9c4970dbcc5a2d8d111256a0b3736 (patch) | |
tree | ba47ecf4ae3a974fac1fb7d53fcee3a68e8fd0a4 /src/components/BarcodeScanner.js | |
parent | 8c0f5bd053a926098510b55c9682184c8859a893 (diff) | |
download | mall-app-3b6a18902ee9c4970dbcc5a2d8d111256a0b3736.tar.gz mall-app-3b6a18902ee9c4970dbcc5a2d8d111256a0b3736.tar.bz2 mall-app-3b6a18902ee9c4970dbcc5a2d8d111256a0b3736.zip |
Replaced the BarcodeScanner module from expo-barcode-scanner to expo-camera
Diffstat (limited to 'src/components/BarcodeScanner.js')
-rw-r--r-- | src/components/BarcodeScanner.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/components/BarcodeScanner.js b/src/components/BarcodeScanner.js index 73ae19a..1572062 100644 --- a/src/components/BarcodeScanner.js +++ b/src/components/BarcodeScanner.js @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import { View, Text, Button, Alert } from 'react-native'; -import { BarCodeScanner } from 'expo-barcode-scanner'; +import { CameraView, Camera } from 'expo-camera' const BarcodeScanner = ({ onScan }) => { const [hasPermission, setHasPermission] = useState(null); @@ -8,7 +8,7 @@ const BarcodeScanner = ({ onScan }) => { useEffect(() => { (async () => { - const { status } = await BarCodeScanner.requestPermissionsAsync(); + const { status } = await Camera.requestCameraPermissionsAsync(); setHasPermission(status === 'granted'); })(); }, []); @@ -38,7 +38,7 @@ const BarcodeScanner = ({ onScan }) => { return ( <View style={{ flex: 1 }}> - <BarCodeScanner + <CameraView onBarCodeScanned={scanned ? undefined : handleBarCodeScanned} style={{ flex: 1 }} /> |