moaazsidat / react-native-qrcode-scanner

A QR code scanner component for React Native.
MIT License
2.04k stars 517 forks source link

Crash on android after getting premissions #377

Open Gurin-Andrew opened 2 years ago

Gurin-Andrew commented 2 years ago

Hi i'm new at RN and react, and got issue with my app, after first installation when u need to give premissions for camera, after pressing OK button on permissionDialogMessage, i got crash application, anyone got same issue? part of code `export const QRScannerLogInMoblieScreen: React.FC = ({ navigation, route, }) => { const {type} = route.params;

const [flashModeStatus, setFlashModeStatus] = useState(false); const [permissionStatus, setPermissionStatus] = useState(false); const permissions = Platform.OS === 'ios' ? [PERMISSIONS.IOS.CAMERA] : [PERMISSIONS.ANDROID.CAMERA]; useEffect(() => { (async function checkPermission() { const status = await PermissionsService.check(permissions); setPermissionStatus(status); })(); }, []); .... return ( <QRCodeScanner cameraStyle={styles.containerCamera} onRead={onQrRead} permissionDialogTitle={t.qrCameraPermissionTitle} permissionDialogMessage={t.qrCameraPermissionMessage} showMarker={true} checkAndroid6Permissions={true} bottomContent={permissionStatus ? : undefined} cameraProps={{ flashMode: flashModeStatus ? RNCamera.Constants.FlashMode.torch : RNCamera.Constants.FlashMode.off, }} />

`