Skip to content

Instantly share code, notes, and snippets.

@enriquesaid
Created April 8, 2022 19:39
Show Gist options
  • Save enriquesaid/a06c77cb117fd8f8d515bdf5cbdff540 to your computer and use it in GitHub Desktop.
Save enriquesaid/a06c77cb117fd8f8d515bdf5cbdff540 to your computer and use it in GitHub Desktop.
RN Biometry
import React, { FC, useEffect } from 'react';
import FingerprintScanner from 'react-native-fingerprint-scanner';
const BiometricPopup: FC = () => {
const getMessage = (type: string) => {
if (type === 'Face ID') {
return 'Scan your Face on the device to continue';
}
return 'Scan your Fingerprint on the device scanner to continue';
};
useEffect(() => {
FingerprintScanner.isSensorAvailable().then(async (biometryType) => {
if (biometryType !== null && biometryType !== undefined) {
await FingerprintScanner.authenticate({
description: getMessage(biometryType)
});
// TODO: logic
}
});
}, []);
return <></>;
};
export default BiometricPopup;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment