Hooks

useSupportBiometrics

How to use it?

  • Import useSupportBiometrics:

import useSupportBiometrics from 'LinkerStudio/modules/authentication/Biometrics/hooks/useSupportBiometrics';
  • Add this code block:

const [isSupportedTouchID, isSupportedFaceID] = useSupportBiometrics();

How to get biometrics support?

  • Import the CONFIG_VALUES constant containing the strings of the supported biometric types:

import {CONFIG_VALUES} from 'LinkerStudio/modules/authentication/Biometrics/constants';
  • Import TouchID by adding the following code block:

import TouchID from 'react-native-touch-id';
const getIsSupportedBiometrics = async () => {
    try {
      const biometryType = await TouchID.isSupported();

      if (biometryType === CONFIG_VALUES.biometricsFaceID) {
        // faceID is supported
      }
      
      if (biometryType === CONFIG_VALUES.biometricsTouchID) {
        // touchID is supported
      }
    } catch (error) {
      return error
    }
};

Last updated