Created
April 8, 2022 19:39
-
-
Save enriquesaid/a06c77cb117fd8f8d515bdf5cbdff540 to your computer and use it in GitHub Desktop.
RN Biometry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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