import { Platform } from 'react-native'; import ScanQRFile from './NativeScanQRFile'; export * from './BarcodeScannerViewNativeComponent'; export { default as BarcodeScannerView } from './BarcodeScannerViewNativeComponent'; export async function scan(filePath: string): Promise { if (!ScanQRFile) { return undefined; } return ScanQRFile.scan(filePath); } export async function getNumberOfCameras(): Promise { if (Platform.OS !== 'web') { return 2; } const enumerateDevices = await navigator.mediaDevices.enumerateDevices(); const numberOfCameras = enumerateDevices.filter( (i) => i.kind === 'videoinput' ).length; return numberOfCameras; }