Skip to content

Instantly share code, notes, and snippets.

View srolija's full-sized avatar

Sergej Jakovljev srolija

View GitHub Profile
@srolija
srolija / camera.android.js
Last active November 10, 2021 02:35
Running RNCamera for high performance scanning or QR codes. You'll need to follow this guide: https://react-native-community.github.io/react-native-camera/docs/installation and setup the Firebase, but only on Android. There is no need to use MLKit on iOS as its internal code detection is performant enough even on old devices.
/* eslint-disable react/jsx-props-no-spreading */
import React from 'react';
import PropTypes from 'prop-types';
import { RNCamera } from 'react-native-camera';
const RNCameraAndroid = ({ callback, children, ...props }) => {
const barcodeHandler = ({ barcodes }) => {
if (barcodes.length === 0) {
return;
}
@srolija
srolija / camera.android.js
Last active August 1, 2022 15:51
QR Scanner in React Native - Unlike most tutorials out there this one cares about performance and therefore uses most performant packages on each platform along with validation of permissions with best UX on both platforms.
import React from 'react';
import { PermissionsAndroid, Platform } from 'react-native';
import BarcodeScanner, {
BarcodeType,
TorchMode,
PrecisionMode,
} from 'react-native-barcode-scanner-google';