import { BarCodeScanner, BarCodePoint, BarCodeBounds } from 'expo-barcode-scanner'; import * as ScreenOrientation from 'expo-screen-orientation'; import React from 'react'; import { Button, Platform, StyleSheet, Text, View } from 'react-native'; import * as Svg from 'react-native-svg'; const BUTTON_COLOR = Platform.OS === 'ios' ? '#fff' : '#666'; type State = { type: any; cornerPoints?: BarCodePoint[]; alerting: boolean; haveDimensions: boolean; canvasHeight?: number; canvasWidth?: number; boundingBox?: BarCodeBounds; cornerPointsString?: string; showBoundingBox: boolean; showText: boolean; data: string; }; const initialState: State = { type: BarCodeScanner.Constants.Type.back, alerting: false, haveDimensions: false, showBoundingBox: false, data: '', showText: false, }; function reducer(state: State, action: Partial): State { return { ...state, ...action, }; } export default function BarcodeScannerScreen() { const [permission, requestPermission] = BarCodeScanner.usePermissions(); if (!permission) { return null; } if (permission.granted) { return ; } return ( You have not granted permission to use the camera on this device!